pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix crash in psql when attempting to reuse old connection
Date: Wed, 01 Apr 2020 05:50:52 +0000
Message-ID: <E1jJWH6-0008CT-LV@gemulon.postgresql.org> (raw)

Fix crash in psql when attempting to reuse old connection

In a psql session, if the connection to the server is abruptly cut, the
referenced connection would become NULL as of CheckConnection().  This
could cause a hard crash with psql if attempting to connect by reusing
the past connection's data because of a null-pointer dereference with
either PQhost() or PQdb().  This issue is fixed by making sure that no
reuse of the past connection is done if it does not exist.

Issue has been introduced by 6e5f8d4, so backpatch down to 12.

Reported-by: Hugh Wang
Author: Michael Paquier
Reviewed-by: Álvaro Herrera, Tom Lane
Discussion: https://postgr.es/m/16330-b34835d83619e25d@postgresql.org
Backpatch-through: 12

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f79bea4b6bcd2e5a801915a179bed2684168f89e

Modified Files
--------------
src/bin/psql/command.c | 5 +++++
1 file changed, 5 insertions(+)



view thread (2+ messages)  latest in thread

Message-ID: <E1jJWH6-0008CT-LV@gemulon.postgresql.org>
Permalink:  ../E1jJWH6-0008CT-LV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jJWH6-0008CT-LV@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: michael@paquier.xyz
  Subject: Re: pgsql: Fix crash in psql when attempting to reuse old connection
  In-Reply-To: <E1jJWH6-0008CT-LV@gemulon.postgresql.org>
  References: <E1jJWH6-0008CT-LV@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