From: Michael Paquier <michael@paquier.xyz>
To: gregk@stoddarts.com.au
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15578: Executing json_populate_recordset with an empty array causes a segmentation fault
Date: Mon, 7 Jan 2019 13:59:18 +0900
Message-ID: <20190107045918.GC22498@paquier.xyz> (raw)
In-Reply-To: <15578-832c854e58dde50c@postgresql.org>
References: <15578-832c854e58dde50c@postgresql.org>
On Mon, Jan 07, 2019 at 03:52:26AM +0000, PG Bug reporting form wrote:
> When executing json_populate_recordset/jsonb_populate_recordset with an
> empty array, a segmentation fault occurs and the server process is
> terminated. The issue occurs regardless of the type used. In previous
> versions this would return null.
This has been already fixed by a recent commit, which will be released
with 11.2 in the next round of minor releases (see also 595220a which
applies to REL_11_STABLE):
commit: eba2ce17121f198316d050e71d8bd049a43783ba
author: Tom Lane <tgl@sss.pgh.pa.us>
date: Thu, 22 Nov 2018 15:14:01 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date: Thu, 22 Nov 2018 15:14:01 -0500
Fix another crash in json{b}_populate_recordset and
json{b}_to_recordset.
populate_recordset_worker() failed to consider the possibility that the
supplied JSON data contains no rows, so that update_cached_tupdesc never
got called. This led to a null-pointer dereference since commit 9a5e8ed28;
before that it led to a bogus "set-valued function called in context
that cannot accept a set" error. Fix by forcing the update to happen.
Per bug #15514. Back-patch to v11 as 9a5e8ed28 was. (If we were excited
about the bogus error, we could perhaps go back further, but it'd take more
work to figure out how to fix it in older branches. Given the lack of
field complaints about that aspect, I'm not excited.)
Discussion: https://postgr.es/m/15514-59d5b4c4065b178b@postgresql.org
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, gregk@stoddarts.com.au
Subject: Re: BUG #15578: Executing json_populate_recordset with an empty array causes a segmentation fault
In-Reply-To: <20190107045918.GC22498@paquier.xyz>
References: <15578-832c854e58dde50c@postgresql.org> <20190107045918.GC22498@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox