diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2025-01-25 00:36:48 +0100 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2025-01-25 02:15:57 +0100 |
commit | 88d322a160e3e648406ffa692b0988c1b0fe2db8 (patch) | |
tree | 2363f978880ec1e8005e31de1a368e60307ff393 | |
parent | 63644c15d74e5ed4243bcbe8becf34d497565060 (diff) | |
download | postgresql-88d322a160e3e648406ffa692b0988c1b0fe2db8.tar.gz postgresql-88d322a160e3e648406ffa692b0988c1b0fe2db8.zip |
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/928bdab1-6567-449f-98c4-339cd2203b87@vondra.me
-rw-r--r-- | src/backend/storage/file/buffile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c index 1b37062321a..46d32e180de 100644 --- a/src/backend/storage/file/buffile.c +++ b/src/backend/storage/file/buffile.c @@ -430,7 +430,7 @@ BufFileLoadBuffer(BufFile *file) thisfile = file->files[file->curFile]; file->nbytes = FileRead(thisfile, file->buffer.data, - sizeof(file->buffer), + sizeof(file->buffer.data), file->curOffset, WAIT_EVENT_BUFFILE_READ); if (file->nbytes < 0) |