postgresql/contrib/jsonb_plperl
Tom Lane da82fbb8f9 jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
Add check_stack_depth() to Jsonb_to_SV, SV_to_JsonbValue,
PLyObject_FromJsonbContainer, and PLyObject_ToJsonbValue.  Without
this, deeply nested JSONB values can crash the backend with SIGSEGV
instead of raising a proper error.

Also add CHECK_FOR_INTERRUPTS() to the while loop in SV_to_JsonbValue
that dereferences chains of Perl references, so that a circular
reference (e.g. $x = \$x) can be cancelled by the user instead of
spinning indefinitely.  (We looked at detecting such circular
references, but it seems more trouble than it's worth.)

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAJ7c6TPbjkzUk4qJ5dHvDNEz0hBuFue3A-XWz_=897z+BC+z8A@mail.gmail.com
Backpatch-through: 14
2026-06-17 11:04:41 -04:00
..
expected Fix handling of "undef" in contrib/jsonb_plperl. 2019-08-04 14:05:34 -04:00
sql Fix handling of "undef" in contrib/jsonb_plperl. 2019-08-04 14:05:34 -04:00
.gitignore Transforms for jsonb to PL/Perl 2018-04-03 09:47:18 -04:00
jsonb_plperl--1.0.sql Transforms for jsonb to PL/Perl 2018-04-03 09:47:18 -04:00
jsonb_plperl.c jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. 2026-06-17 11:04:41 -04:00
jsonb_plperl.control Mark some contrib modules as "trusted". 2020-02-13 15:02:35 -05:00
jsonb_plperlu--1.0.sql Fix inconsistencies and typos in the tree 2019-07-22 10:01:50 +09:00
jsonb_plperlu.control Transforms for jsonb to PL/Perl 2018-04-03 09:47:18 -04:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00