Skip to content

Commit 88d322a

Browse files
committed
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 44cac93, 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 44cac93 went into 12, but that's EOL. Backpatch-through: 13 Discussion: https://postgr.es/m/928bdab1-6567-449f-98c4-339cd2203b87@vondra.me
1 parent 63644c1 commit 88d322a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/storage/file/buffile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ BufFileLoadBuffer(BufFile *file)
430430
thisfile = file->files[file->curFile];
431431
file->nbytes = FileRead(thisfile,
432432
file->buffer.data,
433-
sizeof(file->buffer),
433+
sizeof(file->buffer.data),
434434
file->curOffset,
435435
WAIT_EVENT_BUFFILE_READ);
436436
if (file->nbytes < 0)

0 commit comments

Comments
 (0)