agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. 6+ messages / 1 participants [nested] [flat]
* pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. @ 2026-08-10 13:41 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 6+ messages in thread From: Noah Misch @ 2026-08-10 13:41 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Harden PL/Perl code against "tied" Perl arrays and hashes. Tied arrays might report different sizes each time they are inspected. To avoid generating a corrupt result array, fix plperl_array_to_datum() to read av_len() of each input array only once. If the input does appear to get shorter, we'll fill nulls for the now-missing entries, which seems fine. Conversely, if it gets longer, we'll ignore the new entries. plperl_to_hstore() assumed that Perl's hv_iterinit() returns the number of entries in the given Perl hash. Usually that's true, but per the Perl docs, "the return value is currently only meaningful for hashes without tie magic". That could potentially end in a memory stomp. We don't depend on that result value anywhere else, so don't do so here either. Reported-by: Hcamael <baiyjrh@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 14 Security: CVE-2026-14670 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/63cb15f40c6e4b5d74805e2f54231be09ac1783b Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++-- src/pl/plperl/plperl.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. @ 2026-08-10 13:41 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 6+ messages in thread From: Noah Misch @ 2026-08-10 13:41 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Harden PL/Perl code against "tied" Perl arrays and hashes. Tied arrays might report different sizes each time they are inspected. To avoid generating a corrupt result array, fix plperl_array_to_datum() to read av_len() of each input array only once. If the input does appear to get shorter, we'll fill nulls for the now-missing entries, which seems fine. Conversely, if it gets longer, we'll ignore the new entries. plperl_to_hstore() assumed that Perl's hv_iterinit() returns the number of entries in the given Perl hash. Usually that's true, but per the Perl docs, "the return value is currently only meaningful for hashes without tie magic". That could potentially end in a memory stomp. We don't depend on that result value anywhere else, so don't do so here either. Reported-by: Hcamael <baiyjrh@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 14 Security: CVE-2026-14670 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8c48cd615195e80925fb81ad77bd08a8bd4eb0c2 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++-- src/pl/plperl/plperl.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. @ 2026-08-10 13:41 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 6+ messages in thread From: Noah Misch @ 2026-08-10 13:41 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Harden PL/Perl code against "tied" Perl arrays and hashes. Tied arrays might report different sizes each time they are inspected. To avoid generating a corrupt result array, fix plperl_array_to_datum() to read av_len() of each input array only once. If the input does appear to get shorter, we'll fill nulls for the now-missing entries, which seems fine. Conversely, if it gets longer, we'll ignore the new entries. plperl_to_hstore() assumed that Perl's hv_iterinit() returns the number of entries in the given Perl hash. Usually that's true, but per the Perl docs, "the return value is currently only meaningful for hashes without tie magic". That could potentially end in a memory stomp. We don't depend on that result value anywhere else, so don't do so here either. Reported-by: Hcamael <baiyjrh@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 14 Security: CVE-2026-14670 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/87c4b821972c9b66ced5520636c8ad4b60f8fd81 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++-- src/pl/plperl/plperl.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. @ 2026-08-10 13:41 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 6+ messages in thread From: Noah Misch @ 2026-08-10 13:41 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Harden PL/Perl code against "tied" Perl arrays and hashes. Tied arrays might report different sizes each time they are inspected. To avoid generating a corrupt result array, fix plperl_array_to_datum() to read av_len() of each input array only once. If the input does appear to get shorter, we'll fill nulls for the now-missing entries, which seems fine. Conversely, if it gets longer, we'll ignore the new entries. plperl_to_hstore() assumed that Perl's hv_iterinit() returns the number of entries in the given Perl hash. Usually that's true, but per the Perl docs, "the return value is currently only meaningful for hashes without tie magic". That could potentially end in a memory stomp. We don't depend on that result value anywhere else, so don't do so here either. Reported-by: Hcamael <baiyjrh@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 14 Security: CVE-2026-14670 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2d78c34f8257d00f5fc65b8092c43dc77e246939 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++-- src/pl/plperl/plperl.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. @ 2026-08-10 13:41 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 6+ messages in thread From: Noah Misch @ 2026-08-10 13:41 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Harden PL/Perl code against "tied" Perl arrays and hashes. Tied arrays might report different sizes each time they are inspected. To avoid generating a corrupt result array, fix plperl_array_to_datum() to read av_len() of each input array only once. If the input does appear to get shorter, we'll fill nulls for the now-missing entries, which seems fine. Conversely, if it gets longer, we'll ignore the new entries. plperl_to_hstore() assumed that Perl's hv_iterinit() returns the number of entries in the given Perl hash. Usually that's true, but per the Perl docs, "the return value is currently only meaningful for hashes without tie magic". That could potentially end in a memory stomp. We don't depend on that result value anywhere else, so don't do so here either. Reported-by: Hcamael <baiyjrh@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 14 Security: CVE-2026-14670 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/477a6bdb086106fb5b0bf5b87f01fffd8393d340 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++-- src/pl/plperl/plperl.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. @ 2026-08-10 13:41 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 6+ messages in thread From: Noah Misch @ 2026-08-10 13:41 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Harden PL/Perl code against "tied" Perl arrays and hashes. Tied arrays might report different sizes each time they are inspected. To avoid generating a corrupt result array, fix plperl_array_to_datum() to read av_len() of each input array only once. If the input does appear to get shorter, we'll fill nulls for the now-missing entries, which seems fine. Conversely, if it gets longer, we'll ignore the new entries. plperl_to_hstore() assumed that Perl's hv_iterinit() returns the number of entries in the given Perl hash. Usually that's true, but per the Perl docs, "the return value is currently only meaningful for hashes without tie magic". That could potentially end in a memory stomp. We don't depend on that result value anywhere else, so don't do so here either. Reported-by: Hcamael <baiyjrh@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Backpatch-through: 14 Security: CVE-2026-14670 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cf4ae7c3bff2e22f3fb1a92a4cbaefb40a482251 Author: Tom Lane <tgl@sss.pgh.pa.us> Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++-- src/pl/plperl/plperl.c | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-08-10 13:41 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-10 13:41 pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. Noah Misch <noah@leadboat.com> 2026-08-10 13:41 pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. Noah Misch <noah@leadboat.com> 2026-08-10 13:41 pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. Noah Misch <noah@leadboat.com> 2026-08-10 13:41 pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. Noah Misch <noah@leadboat.com> 2026-08-10 13:41 pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. Noah Misch <noah@leadboat.com> 2026-08-10 13:41 pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. Noah Misch <noah@leadboat.com>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox