forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitffd1b6b
committed
Add overflow protection for block-related data in WAL records
XLogRecordBlockHeader, the header holding the information for the datarelated to a block, tracks the length of the data appended to the WALrecord with data_length (uint16). This limitation in size was notenforced by the public routine in charge of registering the dataassembled later to form the WAL record inserted, XLogRegisterBufData().Incorrectly used, it could lead to the generation of records with someof its data overflowed. This commit adds some safeguards to preventthat for the block data, complaining immediately if attempting to add toa record block information with a size larger than UINT16_MAX, which isthe limit implied by the internal logic.Note that this also adjusts XLogRegisterData() and XLogRegisterBufData()so as the length of the WAL record data given by the caller is unsigned,matching with what gets stored in XLogRecData->len.Extracted from a larger patch by the same author. The original patchincludes more protections when assembling a record in full that will belooked at separately later.Author: Matthias van de MeentReviewed-by: Andres Freund, Heikki Linnakangas, Michael Paquier, DavidZhangDiscussion:https://postgr.es/m/CAEze2WgGiw+LZt+vHf8tWqB_6VxeLsMeoAuod0N=ij1q17n5pw@mail.gmail.com1 parent70988b7 commitffd1b6b
File tree
2 files changed
+20
-6
lines changed- src
- backend/access/transam
- include/access
2 files changed
+20
-6
lines changedLines changed: 18 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
348 | 348 |
| |
349 | 349 |
| |
350 | 350 |
| |
351 |
| - | |
| 351 | + | |
352 | 352 |
| |
353 | 353 |
| |
354 | 354 |
| |
| |||
386 | 386 |
| |
387 | 387 |
| |
388 | 388 |
| |
389 |
| - | |
| 389 | + | |
390 | 390 |
| |
391 | 391 |
| |
392 | 392 |
| |
| |||
399 | 399 |
| |
400 | 400 |
| |
401 | 401 |
| |
402 |
| - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
403 | 410 |
| |
| 411 | + | |
404 | 412 |
| |
405 | 413 |
| |
406 | 414 |
| |
| |||
756 | 764 |
| |
757 | 765 |
| |
758 | 766 |
| |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
759 | 773 |
| |
760 | 774 |
| |
761 | 775 |
| |
762 | 776 |
| |
763 | 777 |
| |
764 |
| - | |
| 778 | + | |
765 | 779 |
| |
766 | 780 |
| |
767 | 781 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
| 46 | + | |
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
51 |
| - | |
| 51 | + | |
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
|
0 commit comments
Comments
(0)