| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Harden PL/Perl code against "tied" Perl arrays and hashes. |
| Date: | 2026-08-10 13:41:21 |
| Message-ID: | E1wtQFl-00000000y3B-2vIo@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)gmail(dot)com>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Backpatch-through: 14
Security: CVE-2026-14670
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/8c48cd615195e80925fb81ad77bd08a8bd4eb0c2
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Modified Files
--------------
contrib/hstore_plperl/hstore_plperl.c | 11 +++++++++--
src/pl/plperl/plperl.c | 6 +++++-
2 files changed, 14 insertions(+), 3 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-08-10 13:41:22 | pgsql: Return nulls honestly in aggregate "combine" functions. |
| Previous Message | Noah Misch | 2026-08-10 13:41:20 | pgsql: Fix pg_trgm's picksplit function with all-true datums |