pgsql: Fix off-by-one Asserts in FreePageBtreeInsertInternal/Leaf.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix off-by-one Asserts in FreePageBtreeInsertInternal/Leaf.
Date: 2025-10-23 16:33:18
Message-ID: E1vByFa-003984-2r@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix off-by-one Asserts in FreePageBtreeInsertInternal/Leaf.

These two functions expect there to be room to insert another item
in the FreePageBtree's array, but their assertions were too weak
to guarantee that. This has little practical effect granting that
the callers are not buggy, but it seems to be misleading late-model
Coverity into complaining about possible array overrun.

Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/799984.1761150474@sss.pgh.pa.us
Backpatch-through: 13

Branch
------
REL_18_STABLE

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

Modified Files
--------------
src/backend/utils/mmgr/freepage.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-10-23 18:23:31 pgsql: Avoid memory leak in validation of a PL/Python trigger function.
Previous Message Tom Lane 2025-10-23 15:48:03 pgsql: Fix resource leaks in PL/Python error reporting, redux.