pgsql: Be more wary about constant's datatype in scalarineqsel(). - Mailing list pgsql-committers

From Noah Misch
Subject pgsql: Be more wary about constant's datatype in scalarineqsel().
Date
Msg-id E1wtQFj-00000000y0k-3FLt@gemulon.postgresql.org
Whole thread
Responses pgsql: Replace fixed-size, too-short array with a palloc'd one.
List pgsql-committers
Be more wary about constant's datatype in scalarineqsel().

The special case here for estimating conditions involving a ctid
column failed to check that the RHS constant is of type tid.
While that'd always be true for the built-in operators that
reference this selectivity estimator, a maliciously constructed
operator could provide a user-controlled Datum value that would
get interpreted as an ItemPointer pointer.  That at least risks
SIGSEGV, and perhaps with a bit of sweat it could be used for
server memory disclosure.

Reported-by: Hcamael <baiyjrh@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Backpatch-through: 14
Security: CVE-2026-14668

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8f0c3d2feb9d7a9905d1ed0122ff1fb2bd3cfb0a
Author: Tom Lane <tgl@sss.pgh.pa.us>

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


pgsql-committers by date:

Previous
From: John Naylor
Date:
Subject: Re: pgsql: Rename sort support integer comparators for clarity
Next
From: Noah Misch
Date:
Subject: pgsql: Cross-check the type of a portal running EXECUTE or FETCH.