postgres.git / summary / log / commit / refs
commit 4892c9447e315f00be028d90a60e1e0ccfe3992d
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 c033e68ba15..5d1c0e0a7bf 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -639,7 +639,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: 19ab0bae3aa3]