pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Defend against null "SV *" pointers in plperl modules. 7+ messages / 1 participants [nested] [flat]
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/c0641ae4e16276d9b429bdfd60879c7e64dee97e Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 161 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 86 insertions(+), 79 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/fe06b9b5bd61dc04ab788091c56a0cb9ef44b3d2 Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 161 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 86 insertions(+), 79 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b6193ff038552762dca38ff6c3b046f873ccd96f Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 155 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 83 insertions(+), 76 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2860d322ae98dd3c1f8608fc02fb777dd51d41f2 Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 155 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 83 insertions(+), 76 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d54d3f5d954e2ffa1df4ad7199847e2bc5afd101 Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 155 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 83 insertions(+), 76 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/aecc864821ad868618166d06f1bbdd892a73e19d Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 155 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 83 insertions(+), 76 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Defend against null "SV *" pointers in plperl modules. @ 2026-08-18 21:34 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 7+ messages in thread From: Tom Lane @ 2026-08-18 21:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Defend against null "SV *" pointers in plperl modules. Tied hashes, and probably tied arrays, are capable of returning Perl value pointers that are actually NULL, not the usual pointer to an undef SV. We were not defending against that everywhere, leading to possible SIGSEGV. Fix the code to consistently treat a null pointer returned from hv_iternext or av_fetch like a !SvOK one. (Note that the large diff in SV_to_JsonbValue is actually quite trivial, but it required reindenting a chunk of existing code.) Claude Code found the instance in hstore_plperl, and I found the others by code auditing. Perhaps the other instances aren't actually reachable, but I see little reason to assume that. The known test cases for these errors require perl's Tie modules, which may not be present, so it doesn't seem worth the trouble to create regression test cases that would cover them. Reported-by: Claude Code (via Noah Misch) Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/569769.1786901901@sss.pgh.pa.us Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ec24237a40c695f4a4364039e778361c3103c330 Modified Files -------------- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/jsonb_plperl/jsonb_plperl.c | 155 ++++++++++++++++++---------------- src/pl/plperl/plperl.c | 2 +- 3 files changed, 83 insertions(+), 76 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2026-08-18 21:34 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us> 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us> 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us> 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us> 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us> 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us> 2026-08-18 21:34 pgsql: Defend against null "SV *" pointers in plperl modules. Tom Lane <tgl@sss.pgh.pa.us>
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