pgsql: Fix fuzzy error handling in pg_basebackup when opening gzFile

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix fuzzy error handling in pg_basebackup when opening gzFile
Date: 2020-02-04 04:57:58
Message-ID: E1iyqHe-0005i0-6U@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix fuzzy error handling in pg_basebackup when opening gzFile

First, this code did not bother checking for a failure when calling
dup(). Then, per zlib, gzerror() returns NULL for a NULL input, which
can happen if passing down to gzdopen() an invalid file descriptor or if
there was an allocation failure.

No back-patch is done as this would unlikely be a problem in the field.

Per Coverity.

Reported-by: Tom Lane

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/177be9edf4bb966400db7769d61e479aa0fe0201

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2020-02-04 10:17:24 Re: pgsql: Handle lack of DSM slots in parallel btree build.
Previous Message Alvaro Herrera 2020-02-03 22:00:44 pgsql: Add missing break out seqscan loop in logical replication