pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. 4+ messages / 1 participants [nested] [flat]
* pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@sss.pgh.pa.us> Backpatch-through: 14 Security: CVE-2026-116323 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/bc1fa1003f633735b641604e0fca68c963e78643 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- src/pl/tcl/pltcl.c | 73 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@sss.pgh.pa.us> Backpatch-through: 14 Security: CVE-2026-116323 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5eaab71a7393d4b5e19ae69b267146eb764664fe Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- src/pl/tcl/pltcl.c | 73 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@sss.pgh.pa.us> Backpatch-through: 14 Security: CVE-2026-116323 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f01727316219146fd54cc6448c540a5a50550c29 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- src/pl/tcl/pltcl.c | 73 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. @ 2026-11-09 14:22 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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@sss.pgh.pa.us> Backpatch-through: 14 Security: CVE-2026-116323 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/9d15ca06332471d25e863e6a844879da9742faa9 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- src/pl/tcl/pltcl.c | 73 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-11-09 14:22 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-09 14:21 pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. Noah Misch <noah@leadboat.com> 2026-11-09 14:22 pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. Noah Misch <noah@leadboat.com>
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