forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4fb6478
committed
Add defenses against running with a wrong selection of LOBLKSIZE.
It's critical that the backend's idea of LOBLKSIZE match the way data hasactually been divided up in pg_largeobject. While we don't provide anydirect way to adjust that value, doing so is a one-line source code changeand various people have expressed interest recently in changing it. So,just as with TOAST_MAX_CHUNK_SIZE, it seems prudent to record the value inpg_control and cross-check that the backend's compiled-in setting matchesthe on-disk data.Also tweak the code in inv_api.c so that fetches from pg_largeobjectexplicitly verify that the length of the data field is not more thanLOBLKSIZE. Formerly we just had Asserts() for that, which is no protectionat all in production builds. In some of the call sites an overlength datavalue would translate directly to a security-relevant stack clobber, so itseems worth one extra runtime comparison to be sure.In the back branches, we can't change the contents of pg_control; but wecan still make the extra checks in inv_api.c, which will offer some amountof protection against running with the wrong value of LOBLKSIZE.1 parent315442c commit4fb6478
1 file changed
+39
-45
lines changedLines changed: 39 additions & 45 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
175 |
| - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
176 | 184 |
| |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
181 | 206 |
| |
182 | 207 |
| |
183 | 208 |
| |
| |||
363 | 388 |
| |
364 | 389 |
| |
365 | 390 |
| |
| 391 | + | |
366 | 392 |
| |
367 | 393 |
| |
368 | 394 |
| |
369 | 395 |
| |
370 | 396 |
| |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
377 |
| - | |
378 |
| - | |
379 |
| - | |
| 397 | + | |
| 398 | + | |
380 | 399 |
| |
381 | 400 |
| |
382 | 401 |
| |
| |||
491 | 510 |
| |
492 | 511 |
| |
493 | 512 |
| |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 |
| - | |
499 |
| - | |
500 |
| - | |
501 |
| - | |
502 |
| - | |
| 513 | + | |
503 | 514 |
| |
504 | 515 |
| |
505 | 516 |
| |
| |||
618 | 629 |
| |
619 | 630 |
| |
620 | 631 |
| |
621 |
| - | |
622 |
| - | |
623 |
| - | |
624 |
| - | |
625 |
| - | |
626 |
| - | |
627 |
| - | |
628 |
| - | |
629 |
| - | |
630 |
| - | |
| 632 | + | |
631 | 633 |
| |
632 | 634 |
| |
633 | 635 |
| |
| |||
803 | 805 |
| |
804 | 806 |
| |
805 | 807 |
| |
806 |
| - | |
807 |
| - | |
808 |
| - | |
| 808 | + | |
809 | 809 |
| |
| 810 | + | |
810 | 811 |
| |
811 |
| - | |
812 |
| - | |
813 |
| - | |
814 |
| - | |
815 |
| - | |
816 |
| - | |
817 |
| - | |
818 |
| - | |
| 812 | + | |
819 | 813 |
| |
820 | 814 |
| |
821 | 815 |
| |
|
0 commit comments
Comments
(0)