Re: Bug in heap_get_root_tuples - Mailing list pgsql-bugs

From Richard Guo
Subject Re: Bug in heap_get_root_tuples
Date
Msg-id CAMbWs48CeYG2U=VQd4v7Lnkee+cEbYMycY1NA9Lu=DnQ3tk2BQ@mail.gmail.com
Whole thread
In response to Bug in heap_get_root_tuples  (Konstantin Knizhnik <knizhnik@garret.ru>)
List pgsql-bugs
On Wed, Jul 15, 2026 at 10:37 PM Konstantin Knizhnik <knizhnik@garret.ru> wrote:
> Commit c7aeb775df895db240dcd6f47242f7e08899adfb contains the following
> change:
>
> -                       /* Sanity check */
> -                       if (nextoffnum < FirstOffsetNumber || nextoffnum
>  > maxoff)
> +                       /* Sanity check (pure paranoia) */
> +                       if (offnum < FirstOffsetNumber)
> +                               break;
> +
> +                       /*
> +                        * An offset past the end of page's line pointer
> array is possible
> +                        * when the array was truncated
> +                        */
> +                       if (offnum > maxoff)
>                                  break;
>
>                          lp = PageGetItemId(page, nextoffnum);
>
>
> So it checks `offnum` and uses `nextoffnum`.

Nice catch.  Seems like a copy/pasted typo.

- Richard



pgsql-bugs by date:

Previous
From: surya poondla
Date:
Subject: Re: BUG #19382: Server crash at __nss_database_lookup
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply