Re: BUG #17912: Invalid memory access when converting plpython' array containing empty array - Mailing list pgsql-bugs

From Alexander Lakhin
Subject Re: BUG #17912: Invalid memory access when converting plpython' array containing empty array
Date
Msg-id 9cd163da-d096-7e9e-28f6-f3620962a660@gmail.com
Whole thread Raw
In response to Re: BUG #17912: Invalid memory access when converting plpython' array containing empty array  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #17912: Invalid memory access when converting plpython' array containing empty array  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #17912: Invalid memory access when converting plpython' array containing empty array  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
30.04.2023 19:24, Tom Lane wrote:
> Here's a version that adopts plperl's logic, causing it to treat
> empty sub-lists as being zero-length dimensions.  Most of the new
> test cases are borrowed from plperl, too, and most of them act
> differently before and after the code change.  So I'm pretty
> hesitant to put this into stable branches.  OTOH, maybe it's not
> too late for v16?

Thanks for the patch!
I've tested the new implementation and found no issues with it — only
rectangular structures are accepted now. The code is straightforward and
very similar to plperl's, so I would not expect that it might bring new
anomalies, which couldn't be seen before.
Thus I don't think that adding it to current master (and possible follow-up
fixing) can take a significant amount of time out of v16+ schedule only.

> I noticed one inarguable bug here, too: PLySequence_ToArray_recurse
> leaks Python object refcounts after errors, because it has no
> PG_TRY to ensure that Py_XDECREF() gets done.  I'm not sure if
> it's worth doing something about that in the back branches, given
> the lack of complaints.

I continue watching the array handling bugs dancing Sirtaki too. Now it's
another asymmetry:
select '{{1},{{2}}}'::int[];
  {{{1}},{{2}}}
but:
select '{{{1}},{2}}'::int[];
  {}

Reproduced on REL_11_STABLE..master.

Best regards,
Alexander



pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #17906: Segmentation fault and database crash during procedure call
Next
From: PG Bug reporting form
Date:
Subject: BUG #17914: walsenders taking up all memory