| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. |
| Date: | 2026-11-09 14:22:13 |
| Message-ID: | E1xQQGD-0000000048l-0A3S@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Avoid use-after-free hazards in re-entrant use of pltcl.
When pltcl invokes a SQL datatype input function, it was passing a
string that is owned by the Tcl interpreter. This is hazardous
since the input function could re-entrantly call the same Tcl
interpreter (for example, via a pltcl function in a domain check
constraint), and that call could modify or free the string we're
depending on. Avoid the hazard by ensuring that we've pstrdup'd
whatever Tcl returned.
In all of these call sites, there's no great need to worry about
pfree'ing the extra string immediately, since we're either inside a
short-lived subtransaction or about to return from the pltcl function.
So I didn't complicate the code by doing that.
Reported-by: Anthropic OSS program
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Backpatch-through: 14
Security: CVE-2026-116323
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/b2b0f9507ab4f5da6eb0ef254620444819d8fdad
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Modified Files
--------------
src/pl/tcl/pltcl.c | 73 +++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 53 insertions(+), 20 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-11-09 14:22:14 | pgsql: Reject extnamespace if it's temporary or it's '$user'::regnamesp |
| Previous Message | Noah Misch | 2026-11-09 14:22:12 | pgsql: Work around broken TimescaleDB code |