pgsql: Add additional sanity checks when reading a blkreftable.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add additional sanity checks when reading a blkreftable.
Date: 2026-07-15 18:02:32
Message-ID: E1wk3wF-000Kah-0z@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add additional sanity checks when reading a blkreftable.

Code elsewhere in the system assumes that fork numbers and chunk sizes
are within bounds, so the code that reads those quantities from disk
should validate that they are. Without these additional checks, a
corrupted file can cause us to index off the end of fork number or chunk
entry arrays, potentially resulting in a crash.

Reported-by: oxsignal <awo(at)kakao(dot)com> (chunk sizes)
Reported-by: Robert Haas <rhaas(at)postgresql(dot)org> (fork numbers)
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: http://postgr.es/m/CA+TgmoYP8RKoBGosS7C6Fdr-GNCfyz_W1zmK=Tx1Fe0ZvzGh0g@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/95c1b8ec7773817d8626d0aad6e7424b3c5ef04d

Modified Files
--------------
src/common/blkreftable.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2026-07-15 19:36:16 pgsql: Fix like_fixed_prefix_ci() selectivity.
Previous Message Tom Lane 2026-07-15 17:24:09 pgsql: Make max_pinned_buffers be > 0, don't just Assert that it is.