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@postgresql.org
Subject: pgsql: Fix corner-case coredump in _SPI_error_callback().
Date: Mon, 11 Dec 2017 21:34:41 +0000
Message-ID: <E1eOVij-0000eh-0B@gemulon.postgresql.org> (raw)

Fix corner-case coredump in _SPI_error_callback().

I noticed that _SPI_execute_plan initially sets spierrcontext.arg = NULL,
and only fills it in some time later.  If an error were to happen in
between, _SPI_error_callback would try to dereference the null pointer.
This is unlikely --- there's not much between those points except
push-snapshot calls --- but it's clearly not impossible.  Tweak the
callback to do nothing if the pointer isn't set yet.

It's been like this for awhile, so back-patch to all supported branches.

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/239b01e313b5c3bc90d383b0a345e0549fe9ba96

Modified Files
--------------
src/backend/executor/spi.c | 3 +++
1 file changed, 3 insertions(+)



view thread (6+ messages)

Message-ID: <E1eOVij-0000eh-0B@gemulon.postgresql.org>
Permalink:  ../E1eOVij-0000eh-0B@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eOVij-0000eh-0B@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 corner-case coredump in _SPI_error_callback().
  In-Reply-To: <E1eOVij-0000eh-0B@gemulon.postgresql.org>
  References: <E1eOVij-0000eh-0B@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