pgsql: Guard against unexpected dimensions of oidvector/int2vector.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Guard against unexpected dimensions of oidvector/int2vector.
Date: 2026-02-09 15:15:06
Message-ID: E1vpSyf-0026C5-2R@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Guard against unexpected dimensions of oidvector/int2vector.

These data types are represented like full-fledged arrays, but
functions that deal specifically with these types assume that the
array is 1-dimensional and contains no nulls. However, there are
cast pathways that allow general oid[] or int2[] arrays to be cast
to these types, allowing these expectations to be violated. This
can be exploited to cause server memory disclosure or SIGSEGV.
Fix by installing explicit checks in functions that accept these
types.

Reported-by: Altan Birler <altan(dot)birler(at)tum(dot)de>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Security: CVE-2026-2003
Backpatch-through: 14

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/access/hash/hashfunc.c | 2 ++
src/backend/access/nbtree/nbtcompare.c | 3 +++
src/backend/utils/adt/format_type.c | 6 +++++-
src/backend/utils/adt/int.c | 31 ++++++++++++++++++++++++++++++-
src/backend/utils/adt/oid.c | 31 ++++++++++++++++++++++++++++++-
src/include/utils/builtins.h | 1 +
src/test/regress/expected/arrays.out | 5 +++++
src/test/regress/sql/arrays.sql | 4 ++++
8 files changed, 80 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-02-09 17:09:05 pgsql: Fix test "NUL byte in text decrypt" for --without-zlib builds.
Previous Message Tom Lane 2026-02-09 15:15:05 pgsql: Add a syscache on pg_extension.oid.