postgres.git / summary / log / commit / refs
commit 8d7914fa68eaf6bc65cc64b4bf668721763d468c
Author: David Rowley <drowley@postgresql.org>
Date: Wed Nov 18 20:01:04 2026 +0000
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@gmail.com>
Discussion: https://postgr.es/m/19904-57a44a8aa7638ae4@postgresql.org
Backpatch-through: 15
src/backend/utils/adt/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 7d5d57d6d58..65338781530 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -630,7 +630,7 @@ pg_column_is_updatable(PG_FUNCTION_ARGS)
{
Oid reloid = PG_GETARG_OID(0);
AttrNumber attnum = PG_GETARG_INT16(1);
- AttrNumber col = attnum - FirstLowInvalidHeapAttributeNumber;
+ int col = attnum - FirstLowInvalidHeapAttributeNumber;
bool include_triggers = PG_GETARG_BOOL(2);
int events;
[parent: 597d5c1fef84]