pgsql: Sanitize line pointers within contrib/amcheck.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Sanitize line pointers within contrib/amcheck.
Date: 2019-04-25 19:50:55
Message-ID: E1hJkOV-00009C-BH@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Sanitize line pointers within contrib/amcheck.

Adopt a more defensive approach to accessing index tuples in
contrib/amcheck: verify that each line pointer looks sane before
accessing associated tuple using pointer arithmetic based on line
pointer's offset. This avoids undefined behavior and assertion failures
in cases where line pointers are corrupt.

Issue spotted following a complaint about an assertion failure by
Grigory Smolkin, which involved a test harness that deliberately
corrupts indexes.

This is arguably a bugfix, but no backpatch given the lack of field
reports beyond Grigory's.

Discussion: https://postgr.es/m/CAH2-WzmkurhCqnyLHxk0VkOZqd49+ZZsp1xAJOg7j2x7dmp_XQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a9ce839a31375a6c04189222706ae6b2abe96919

Modified Files
--------------
contrib/amcheck/verify_nbtree.c | 141 +++++++++++++++++++++++++++++++---------
1 file changed, 109 insertions(+), 32 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2019-04-26 04:20:31 Re: pgsql: Allow insert and update tuple routing and COPY for foreign table
Previous Message Alvaro Herrera 2019-04-25 15:39:07 pgsql: Fix partitioned index attachment