pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix null-pointer crash in postgres_fdw's conversion_error_callba
Date: Wed, 06 Oct 2021 19:50:47 +0000
Message-ID: <E1mYCwB-000704-Ah@gemulon.postgresql.org> (raw)

Fix null-pointer crash in postgres_fdw's conversion_error_callback.

Commit c7b7311f6 adjusted conversion_error_callback to always use
information from the query's rangetable, to avoid doing catalog lookups
in an already-failed transaction.  However, as a result of the utterly
inadequate documentation for make_tuple_from_result_row, I failed to
realize that fsstate could be NULL in some contexts.  That led to a
crash if we got a conversion error in such a context.  Fix by falling
back to the previous coding when fsstate is NULL.  Improve the
commentary, too.

Per report from Andrey Borodin.  Back-patch to 9.6, like the previous
patch.

Discussion: https://postgr.es/m/08916396-55E4-4D68-AB3A-BD6066F9E5C0@yandex-team.ru

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/36c9f7d96e1c95d45c7286a9355011289ab6c087

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out |   3 +
contrib/postgres_fdw/postgres_fdw.c            | 118 ++++++++++++++++---------
contrib/postgres_fdw/sql/postgres_fdw.sql      |   1 +
3 files changed, 82 insertions(+), 40 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1mYCwB-000704-Ah@gemulon.postgresql.org>
Permalink:  ../E1mYCwB-000704-Ah@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mYCwB-000704-Ah@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix null-pointer crash in postgres_fdw's conversion_error_callba
  In-Reply-To: <E1mYCwB-000704-Ah@gemulon.postgresql.org>
  References: <E1mYCwB-000704-Ah@gemulon.postgresql.org>

* 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