Avoid using a dangling pointer in expanded-record domain checks.

build_dummy_expanded_header() sets up the expanded record's dummy
child to have eoh_context equal to the parent's er_short_term_cxt.
If some operation on the dummy record causes creation of a short-term
context belonging to the dummy record itself, that will be a child
of the parent's er_short_term_cxt, which means it will get deleted
when we reset the parent's er_short_term_cxt at the end of the callers
of build_dummy_expanded_header().  So the next time through, we'll try
to use a dangling context pointer, which often will now be pointing
at some other unrelated context.  That at least risks a crash, and
it's reported to be exploitable for arbitrary code execution.
To fix, just clear the potentially-dangling pointer in the next
usage cycle.

Reported-by: Claude and Ada Logics
Author: Tom Lane <[email protected]>
Backpatch-through: 14
Security: CVE-2026-120150

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4614c78a8c3a50a5da064e8db49b5bf20ee69523
Author: Tom Lane <[email protected]>

Modified Files
--------------
src/backend/utils/adt/expandedrecord.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

Reply via email to