pgsql: plpgsql: recheck record field's type after casting value.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: plpgsql: recheck record field's type after casting value.
Date: 2026-11-09 14:22:11
Message-ID: E1xQQGB-0000000044R-10cK@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

plpgsql: recheck record field's type after casting value.

exec_cast_value() can reach code that will change the rowtype of a
RECORD variable, but the RECFIELD case in exec_assign_value() doesn't
account for that and assumes the record field type and column number
that it previously looked up are still good. Recheck that data
if the tuple type ID changed; since that condition never holds in
normal usage, this is a cheap enough safety check.

Reported-by: Claude and Ada Logics
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Backpatch-through: 14
Security: CVE-2026-120151

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3754d3689a8dcdd9fca256c2799f40e69b099151
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 43 +++++++++++++++++++++++++++++++++++--------
1 file changed, 35 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:22:12 pgsql: Add tests for row type changes causing issues
Previous Message Noah Misch 2026-11-09 14:22:10 pgsql: Avoid visiting a type twice in find_composite_type_dependencies(