pgsql: Fix parsePGArray() error checking in pg_dump.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix parsePGArray() error checking in pg_dump.
Date: 2020-11-09 03:28:12
Message-ID: E1kbxqm-0007c5-VB@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix parsePGArray() error checking in pg_dump.

Coverity complained about a defect in commit 257836a7:

Calling "parsePGArray" without checking return value (as is
done elsewhere 11 out of 13 times).

Fix, and also check for empty strings explicitly (NULL as represented by
PQgetvalue()). That worked correctly before only because parsePGArray()
happens to set *nitems = 0 when it fails on an empty string. Also
convert a sanity check assertion to an error to be more paranoid, and
pgindent a nearby line.

Reported-by: Michael Paquier <michael(at)paquier(dot)xyz>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3636efa11945af64479995609762b2626c6c319a

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2020-11-09 04:44:12 Re: pgsql: Skip empty transaction stream in test_decoding.
Previous Message Amit Kapila 2020-11-09 03:10:06 Re: pgsql: Skip empty transaction stream in test_decoding.