pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix type confusion with materialized set-returning functions 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix type confusion with materialized set-returning functions @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 3+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix type confusion with materialized set-returning functions Set-returning functions in the target list with indeterminate RECORD return types incorrectly used the same tuple descriptor to read and return tuples from the tuplestore across invocations. These types of SRFs resolve their rowtype from the passed in record argument and it can differ from invocation to invocation. Reading tuples with the wrong shape of tuple descriptor can lead to incorrect results, crashes, and security issues. It was reported as a way to read arbitrary out-of-line values via json_populate_recordset(). To fix this, drop and recreate the slot and its tuple descriptor per SRF invocation for materialized SRFs in the target list with dynamic RECORD return types. Only the target-list path is affected: table functions in FROM validate every result against the query-supplied descriptor, and value-per-call SRFs never retain a slot. Co-authored-by: Melanie Plageman <melanieplageman@gmail.com> Co-authored-by: Robert Haas <rhaas@postgresql.org> Security: CVE-2026-120141 Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/6f6e4a955cdbef6b08e99dac1cb11d2405709c17 Author: Robert Haas <rhaas@postgresql.org> Modified Files -------------- src/backend/executor/execSRF.c | 59 ++++++++++++++++++++++++++++++++------ src/test/regress/expected/json.out | 11 +++++++ src/test/regress/sql/json.sql | 5 ++++ 3 files changed, 67 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix type confusion with materialized set-returning functions @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 3+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix type confusion with materialized set-returning functions Set-returning functions in the target list with indeterminate RECORD return types incorrectly used the same tuple descriptor to read and return tuples from the tuplestore across invocations. These types of SRFs resolve their rowtype from the passed in record argument and it can differ from invocation to invocation. Reading tuples with the wrong shape of tuple descriptor can lead to incorrect results, crashes, and security issues. It was reported as a way to read arbitrary out-of-line values via json_populate_recordset(). To fix this, drop and recreate the slot and its tuple descriptor per SRF invocation for materialized SRFs in the target list with dynamic RECORD return types. Only the target-list path is affected: table functions in FROM validate every result against the query-supplied descriptor, and value-per-call SRFs never retain a slot. Co-authored-by: Melanie Plageman <melanieplageman@gmail.com> Co-authored-by: Robert Haas <rhaas@postgresql.org> Security: CVE-2026-120141 Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c5dc8b0a0214fbb6d3ac71f811cb6f58e36baaa2 Author: Robert Haas <rhaas@postgresql.org> Modified Files -------------- src/backend/executor/execSRF.c | 59 ++++++++++++++++++++++++++++++++------ src/test/regress/expected/json.out | 11 +++++++ src/test/regress/sql/json.sql | 5 ++++ 3 files changed, 67 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix type confusion with materialized set-returning functions @ 2026-11-09 14:22 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 3+ messages in thread From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix type confusion with materialized set-returning functions Set-returning functions in the target list with indeterminate RECORD return types incorrectly used the same tuple descriptor to read and return tuples from the tuplestore across invocations. These types of SRFs resolve their rowtype from the passed in record argument and it can differ from invocation to invocation. Reading tuples with the wrong shape of tuple descriptor can lead to incorrect results, crashes, and security issues. It was reported as a way to read arbitrary out-of-line values via json_populate_recordset(). To fix this, drop and recreate the slot and its tuple descriptor per SRF invocation for materialized SRFs in the target list with dynamic RECORD return types. Only the target-list path is affected: table functions in FROM validate every result against the query-supplied descriptor, and value-per-call SRFs never retain a slot. Co-authored-by: Melanie Plageman <melanieplageman@gmail.com> Co-authored-by: Robert Haas <rhaas@postgresql.org> Security: CVE-2026-120141 Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4fb349500a20105ef476c524efea95e7b1c03a66 Author: Robert Haas <rhaas@postgresql.org> Modified Files -------------- src/backend/executor/execSRF.c | 59 ++++++++++++++++++++++++++++++++------ src/test/regress/expected/json.out | 11 +++++++ src/test/regress/sql/json.sql | 5 ++++ 3 files changed, 67 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-11-09 14:22 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-09 14:21 pgsql: Fix type confusion with materialized set-returning functions Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Fix type confusion with materialized set-returning functions Noah Misch <noah@leadboat.com> 2026-11-09 14:22 pgsql: Fix type confusion with materialized set-returning functions 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