pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid using a dangling pointer in expanded-record domain checks.
Date: Mon, 09 Nov 2026 14:21:55 +0000
Message-ID: <E1xQQFv-000000003WS-2Hbr@gemulon.postgresql.org> (raw)

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 <tgl@sss.pgh.pa.us>
Backpatch-through: 14
Security: CVE-2026-120150

Branch
------
REL_19_STABLE

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

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



view thread (3+ messages)  latest in thread

Message-ID: <E1xQQFv-000000003WS-2Hbr@gemulon.postgresql.org>
Permalink:  ../E1xQQFv-000000003WS-2Hbr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xQQFv-000000003WS-2Hbr@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com
  Subject: Re: pgsql: Avoid using a dangling pointer in expanded-record domain checks.
  In-Reply-To: <E1xQQFv-000000003WS-2Hbr@gemulon.postgresql.org>
  References: <E1xQQFv-000000003WS-2Hbr@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox