pgsql: Use ArchiveHandle.lookaheadSize instead of a hardcoded 512

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use ArchiveHandle.lookaheadSize instead of a hardcoded 512
Date: 2026-08-24 08:11:18
Message-ID: E1wyPm1-00000001sOx-0BSl@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use ArchiveHandle.lookaheadSize instead of a hardcoded 512

_discoverArchiveFormat allocates the lookahead buffer used to identify
the archive format and records its size in AH->lookaheadSize, but then
used a hardcoded size in the two plades that need it. Use the field
instead, so that the buffer and its size cannot drift apart and risk
out-of-bound reads.

Author: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: https://postgr.es/m/CAJ7c6TPqLZOMk3hPrgLQvrOg9BCY4SV6bUC_wx54fyquRkBckw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8646214ee20b3754d69f9d087baa7eeb1b7e1d0b

Modified Files
--------------
src/bin/pg_dump/pg_backup_archiver.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-08-24 10:44:40 pgsql: Fix incorrect nmembers calculation in test_bitmapset
Previous Message Michael Paquier 2026-08-24 03:18:06 pgsql: Make stringToNode() infrastructure thread-safe