bufmgr: Fix undefined behaviour with, unrealistically, large temp_buffers
Andres Freund <andres@anarazel.de>
bufmgr: Fix undefined behaviour with, unrealistically, large temp_buffers Quoting Melanie: > Since if buffer is INT_MAX, then the -(buffer + 1) version invokes > undefined behavior while the -buffer - 1 version doesn't. All other places were already using the correct version. I (Andres), copied the code into more places in a patch. Melanie caught it in review, but to prevent more people from copying the bad code, fix it. Even if it is a theoretical issue. We really ought to wrap these accesses in a helper function... As this is a theoretical issue, don't backpatch. Reported-by: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/CAAKRu_aW2SX_LWtwHgfnqYpBrunMLfE9PD6-ioPpkh92XH0qpg@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/buffer/localbuf.c | modified | +1 −1 |
Discussion
- refactoring relation extension and BufferAlloc(), faster COPY 57 messages · 2022-10-29 → 2023-05-03