pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records
@ 2018-07-13 18:17 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-07-13 18:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix crash in json{b}_populate_recordset() and json{b}_to_recordset().

As of commit 37a795a60, populate_recordset_worker() tried to pass back
(as rsi.setDesc) a tupdesc that it also had cached in its fn_extra.
But the core executor would free the passed-back tupdesc, risking a
crash if the function were called again in the same query.  The safest
and least invasive way to fix that is to make an extra tupdesc copy
to pass back.

While at it, I failed to resist the temptation to get rid of unnecessary
get_fn_expr_argtype() calls here and in populate_record_worker().

Per report from Dmitry Dolgov; thanks to Michael Paquier and
Andrew Gierth for investigation and discussion.

Discussion: https://postgr.es/m/CA+q6zcWzN9ztCfR47ZwgTr1KLnuO6BAY6FurxXhovP4hxr+yOQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4984784f836a061985b356c52253b5d83a0cbe65

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c   | 58 ++++++++++++++++++++++---------------
src/test/regress/expected/json.out  | 10 +++++++
src/test/regress/expected/jsonb.out | 10 +++++++
src/test/regress/sql/json.sql       |  2 ++
src/test/regress/sql/jsonb.sql      |  2 ++
5 files changed, 59 insertions(+), 23 deletions(-)



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

* pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records
@ 2018-07-13 18:17 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2018-07-13 18:17 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix crash in json{b}_populate_recordset() and json{b}_to_recordset().

As of commit 37a795a60, populate_recordset_worker() tried to pass back
(as rsi.setDesc) a tupdesc that it also had cached in its fn_extra.
But the core executor would free the passed-back tupdesc, risking a
crash if the function were called again in the same query.  The safest
and least invasive way to fix that is to make an extra tupdesc copy
to pass back.

While at it, I failed to resist the temptation to get rid of unnecessary
get_fn_expr_argtype() calls here and in populate_record_worker().

Per report from Dmitry Dolgov; thanks to Michael Paquier and
Andrew Gierth for investigation and discussion.

Discussion: https://postgr.es/m/CA+q6zcWzN9ztCfR47ZwgTr1KLnuO6BAY6FurxXhovP4hxr+yOQ@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9a5e8ed283e583782b3f40e6ededcb005d5c0333

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c   | 58 ++++++++++++++++++++++---------------
src/test/regress/expected/json.out  | 10 +++++++
src/test/regress/expected/jsonb.out | 10 +++++++
src/test/regress/sql/json.sql       |  2 ++
src/test/regress/sql/jsonb.sql      |  2 ++
5 files changed, 59 insertions(+), 23 deletions(-)



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


end of thread, other threads:[~2018-07-13 18:17 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-13 18:17 pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records Tom Lane <tgl@sss.pgh.pa.us>
2018-07-13 18:17 pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records Tom Lane <tgl@sss.pgh.pa.us>

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