Re: [PATCH] Fix segmentation fault and infinite loop in jsonb_{plperl,plpython}

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Fix segmentation fault and infinite loop in jsonb_{plperl,plpython}
Date: 2026-06-17 11:07:04
Message-ID: CAJ7c6TNSMo3MopnVN-nAQBscYO5_XLsY712twX6o_7mRAF5Hxw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

Thanks for all your great feedback.

> No, it'd be O(N^2) for an N-deep reference chain. Admittedly,
> realistic use-cases would never have more than a couple of layers of
> indirection. But this whole exercise is to guard against adversarial
> inputs, I think. I don't really want to add cycles and complexity to
> make our behavior a bit more friendly in cases that nobody is going
> to get into unless they are trying to break the database.

OK, that's fair enough. Here is the corrected patch.

```
=# SELECT perl_circular();
^CCancel request sent
ERROR: canceling statement due to user request
CONTEXT: PL/Perl function "perl_circular"
```

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v2-0001-jsonb_plperl-jsonb_plpython-Fix-unguarded-recursi.patch text/x-patch 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-06-17 11:21:32 Re: Heads Up: cirrus-ci is shutting down June 1st
Previous Message Nisha Moond 2026-06-17 10:59:11 Re: [PATCH] Preserve replication origin OIDs in pg_upgrade