forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit19f8232
committed
Fix ReadRecentBuffer for local buffers.
It incorrectly used GetBufferDescriptor instead ofGetLocalBufferDescriptor, causing it to not find the correct buffer inmost cases, and performing an out-of-bounds memory read in the cornercase that temp_buffers > shared_buffers.It also bumped the usage-count on the buffer, even if it waspreviously pinned. That won't lead to crashes or incorrect results,but it's different from what the shared-buffer case does, anddifferent from the usual code in LocalBufferAlloc. Fix that too, andmake the code ordering match LocalBufferAlloc() more closely, so thatit's easier to verify that it's doing the same thing.Currently, ReadRecentBuffer() is only used with non-temp relations, inWAL redo, so the broken code is currently dead code. However, it couldbe used by extensions.Backpatch-through: 14Discussion:https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fiReviewed-by: Thomas Munro, Zhang Mingli, Richard Guo1 parentbd6cfbf commit19f8232
1 file changed
+16
-6
lines changedLines changed: 16 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
636 | 636 |
| |
637 | 637 |
| |
638 | 638 |
| |
639 |
| - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
640 | 642 |
| |
641 | 643 |
| |
642 | 644 |
| |
643 | 645 |
| |
644 | 646 |
| |
645 |
| - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
646 | 660 |
| |
647 |
| - | |
648 |
| - | |
649 |
| - | |
650 |
| - | |
651 | 661 |
| |
652 | 662 |
| |
653 | 663 |
| |
|
0 commit comments
Comments
(0)