agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
6+ messages / 1 participants
[nested] [flat]

* pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
@ 2026-06-17 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-17 15:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/da82fbb8f9a3b1e46b55d5975ef59113cd3a59a6

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c     | 15 +++++++++++++++
contrib/jsonb_plpython/jsonb_plpython.c |  7 +++++++
2 files changed, 22 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
@ 2026-06-17 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-17 15:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e3b7a43fa9b6f7f5d33584080276bea66606b644

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c     | 15 +++++++++++++++
contrib/jsonb_plpython/jsonb_plpython.c |  7 +++++++
2 files changed, 22 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
@ 2026-06-17 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-17 15:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3df0b77558d790b72103379555cd406101e9abcb

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c     | 15 +++++++++++++++
contrib/jsonb_plpython/jsonb_plpython.c |  7 +++++++
2 files changed, 22 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
@ 2026-06-17 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-17 15:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b0f3465b6f6aff7809c54b2587d0a85ec4d8452f

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c     | 15 +++++++++++++++
contrib/jsonb_plpython/jsonb_plpython.c |  7 +++++++
2 files changed, 22 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
@ 2026-06-17 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-17 15:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a6f23c3ade0effb827255dd9f7df0d9515ce5b8c

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c     | 15 +++++++++++++++
contrib/jsonb_plpython/jsonb_plpython.c |  7 +++++++
2 files changed, 22 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops.
@ 2026-06-17 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-17 15:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/639fff5118a846fdb604824a87f4d77cc286d89d

Modified Files
--------------
contrib/jsonb_plperl/jsonb_plperl.c     | 15 +++++++++++++++
contrib/jsonb_plpython/jsonb_plpython.c |  7 +++++++
2 files changed, 22 insertions(+)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-06-17 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17 15:04 pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. Tom Lane <tgl@sss.pgh.pa.us>
2026-06-17 15:04 pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. Tom Lane <tgl@sss.pgh.pa.us>
2026-06-17 15:04 pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. Tom Lane <tgl@sss.pgh.pa.us>
2026-06-17 15:04 pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. Tom Lane <tgl@sss.pgh.pa.us>
2026-06-17 15:04 pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. Tom Lane <tgl@sss.pgh.pa.us>
2026-06-17 15:04 pgsql: jsonb_plperl, jsonb_plpython: Fix unguarded recursion and loops. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox