pgsql: Fix wrong variable offset sanity check. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Fix wrong variable offset sanity check.
Date
Msg-id E1wkV1L-000X0I-0K@gemulon.postgresql.org
Whole thread
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/323530e00d279f267265ef32c7e6b40a04c94105

Modified Files
--------------
src/backend/access/heap/pruneheap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Remove SQL function getpgusername()
Next
From: Peter Geoghegan
Date:
Subject: pgsql: Fix wrong variable offset sanity check.