]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix wrong variable offset sanity check.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 16 Jul 2026 22:55:35 +0000 (18:55 -0400)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 16 Jul 2026 22:55:35 +0000 (18:55 -0400)
commit64542957b44cce7e29f1979bcfbf04477234ea3c
tree3ac2666515d4975270bc0208745645e4221462c6
parent048067c04c6c0c0862f0e00c4ebe158ac41bda19
Fix wrong variable offset sanity check.

Commit c7aeb775 rewrote the HOT-chain offset sanity checks in three
places, but in heap_get_root_tuples it accidentally tested offnum -- the
outer loop variable, which is already bounded by the loop condition --
instead of nextoffnum, the offset actually passed to PageGetItemId.  The
pre-c7aeb775 check tested nextoffnum.

With the check ineffective, a stale t_ctid could make PageGetItemId read
past the end of the line pointer array (which is data corruption that we
expect to be able to catch here).

Author: Peter Geoghegan <pg@bowt.ie>
Reported-by: Konstantin Knizhnik <knizhnik@garret.ru>
Discussion: https://postgr.es/m/87c7d8a4-3a82-4334-bee6-e8c2ad3f3293@garret.ru
Backpatch-through: 15
src/backend/access/heap/pruneheap.c