Bug in heap_get_root_tuples

From: Konstantin Knizhnik <knizhnik(at)garret(dot)ru>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Bug in heap_get_root_tuples
Date: 2026-07-15 13:37:16
Message-ID: 87c7d8a4-3a82-4334-bee6-e8c2ad3f3293@garret.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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`.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2026-07-15 14:10:15 Re: BUG #19547: libpqrcv_create_slot dereferences NULL on a malformed CREATE_REPLICATION_SLOT reply
Previous Message Maaz Syed Adeeb 2026-07-15 13:05:06 CREATE INDEX with an expression in an INCLUDE column fails with XX000 "unrecognized node type" instead of 0A000 on master