summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2025-01-24 23:36:48 +0000
committerTomas Vondra2025-01-25 01:12:59 +0000
commit38273b5f831bc7651fc479eacf3644e96a551af8 (patch)
tree62b68cd3165dd5a426185b9c992baaa582b77182
parentbfc5992069cf00b189af83d96a83ae5ebb65e938 (diff)
Use the correct sizeof() in BufFileLoadBuffer
The sizeof() call should reference buffer.data, because that's the buffer we're reading data into, not the whole PGAlignedBuffer union. This was introduced by 44cac93464, which replaced the simple buffer with a PGAlignedBuffer field. It's benign, because the buffer is the largest field of the union, so the sizes are the same. But it's easy to trip over this in a patch, so fix and backpatch. Commit 44cac93464 went into 12, but that's EOL. Backpatch-through: 13 Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/backend/storage/file/buffile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
index 6449f82a72b..a4541b87b8f 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -459,7 +459,7 @@ BufFileLoadBuffer(BufFile *file)
*/
file->nbytes = FileRead(thisfile,
file->buffer.data,
- sizeof(file->buffer),
+ sizeof(file->buffer.data),
file->curOffset,
WAIT_EVENT_BUFFILE_READ);
if (file->nbytes < 0)