pgsql: Robustify pg_column_is_updatable() against overly large attnums

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Robustify pg_column_is_updatable() against overly large attnums
Date: 2026-11-18 20:09:52
Message-ID: E1xTlyZ-00000000I1y-0zSk@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Robustify pg_column_is_updatable() against overly large attnums

Passing an attnum sufficiently close to PG_INT16_MAX could wrap
AttrNumber when offsetting for FirstLowInvalidHeapAttributeNumber,
leading to an attempt to build a Bitmapset with a negative member value
resulting in an ERROR, rather than returning the result as it would for
other nonexistent columns.

Upgrade the type used to 32-bit to avoid this issue.

Bug: #19904
Reported-by: Zheng Hacker <hackerzheng666(at)gmail(dot)com>
Discussion: https://postgr.es/m/19904-57a44a8aa7638ae4@postgresql.org
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8d7914fa68eaf6bc65cc64b4bf668721763d468c

Modified Files
--------------
src/backend/utils/adt/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Melanie Plageman 2026-11-18 22:34:52 pgsql: Recreate read stream across rescans
Previous Message David Rowley 2026-11-18 20:09:40 pgsql: Robustify pg_column_is_updatable() against overly large attnums