Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 38273b5

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 bfc5992 commit 38273b5

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
@@ -459,7 +459,7 @@ BufFileLoadBuffer(BufFile *file)
459459
*/
460460
file->nbytes = FileRead(thisfile,
461461
file->buffer.data,
462-
sizeof(file->buffer),
462+
sizeof(file->buffer.data),
463463
file->curOffset,
464464
WAIT_EVENT_BUFFILE_READ);
465465
if (file->nbytes < 0)

0 commit comments

Comments
 (0)