mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
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 by44cac93464, 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. Commit44cac93464went into 12, but that's EOL. Backpatch-through: 13 Discussion: https://postgr.es/m/928bdab1-6567-449f-98c4-339cd2203b87@vondra.me
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user