pgsql: Fix failure to consider failure cases in GetComboCommandId().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix failure to consider failure cases in GetComboCommandId().
Date: 2015-11-26 18:23:27
Message-ID: E1a21CZ-0001Eb-Ht@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix failure to consider failure cases in GetComboCommandId().

Failure to initially palloc the comboCids array, or to realloc it bigger
when needed, left combocid's data structures in an inconsistent state that
would cause trouble if the top transaction continues to execute. Noted
while examining a user complaint about the amount of memory used for this.
(There's not much we can do about that, but it does point up that repalloc
failure has a non-negligible chance of occurring here.)

In HEAD/9.5, also avoid possible invocation of memcpy() with a null pointer
in SerializeComboCIDState; cf commit 13bba0227.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0da3a9bef7ad36dc640aebf2d0482e18f21561f6

Modified Files
--------------
src/backend/utils/time/combocid.c | 43 ++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 20 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Teodor Sigaev 2015-11-27 16:13:19 pgsql: COPY (INSERT/UPDATE/DELETE .. RETURNING ..)
Previous Message Tom Lane 2015-11-25 22:32:19 pgsql: Be more paranoid about null return values from libpq status func