Re: Assert in pageinspect with NULL pages - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Assert in pageinspect with NULL pages
Date
Msg-id CAH2-WzkOHbSpW=Gs7eZ1CBKNATjMAczktTt=yGqhw9nbPd27sg@mail.gmail.com
Whole thread Raw
In response to Assert in pageinspect with NULL pages  (Daria Lepikhova <d.lepikhova@postgrespro.ru>)
Responses Re: Assert in pageinspect with NULL pages
List pgsql-hackers
On Wed, Mar 23, 2022 at 1:16 AM Michael Paquier <michael@paquier.xyz> wrote:
> As far as I can see, this is
> also possible in bt_page_items_bytea(), gist_page_opaque_info(),
> gin_metapage_info() and gin_page_opaque_info().  All those code paths
> should be protected with some checks on PageGetSpecialSize(), I
> guess, before attempting to read the special area of the page.  Hash
> indexes are protected by checking the expected size of the special
> area, and one code path of btree relies on the opened relation to be a
> btree index.

amcheck's palloc_btree_page() function validates that an 8KiB page is
in fact an nbtree page, in a maximally paranoid way. Might be an
example worth following here.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Corruption during WAL replay
Next
From: Thomas Munro
Date:
Subject: Re: A test for replay of regression tests