Re: plpython: NULL pointer dereference on broken sequence objects

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: plpython: NULL pointer dereference on broken sequence objects
Date: 2026-06-26 06:05:40
Message-ID: CAMbWs4_beAx9kD4NqX3j70TaMVkpSG57y+_barFF2hGUK3yeBA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 25, 2026 at 10:05 PM Ayush Tiwari
<ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
> I think there's a similar problem on the mapping side that v1 doesn't
> cover. PLyMapping_ToJsonbValue and the hstore equivalent fetch items with
> PyMapping_Items() and PyList_GetItem() without checking for NULL, and a
> mapping whose items() raises still would crash the backend.

Right. Those functions have the same issue as PySequence_GetItem().
The attached v2 patch fixes them all.

- Richard

Attachment Content-Type Size
v2-0001-plpython-Fix-NULL-pointer-dereferences-for-broken.patch application/octet-stream 24.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-06-26 06:26:20 Re: Add enable_groupagg GUC parameter to control GroupAggregate usage
Previous Message vignesh C 2026-06-26 05:55:17 Re: Proposal: Conflict log history table for Logical Replication