pgsql: Avoid platform-dependent infinite loop in pg_dump.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid platform-dependent infinite loop in pg_dump.
Date: 2011-11-10 21:10:14
Message-ID: E1RObt0-0000IU-AL@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid platform-dependent infinite loop in pg_dump.

If malloc(0) returns NULL, the binary search in findSecLabels() will
probably go into an infinite loop when there are no security labels,
because NULL-1 is greater than NULL after wraparound.

(We've seen this pathology before ... I wonder whether there's a way to
detect the class of bugs automatically?)

Diagnosis and patch by Steve Singer, cosmetic adjustments by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/cf22e851b6ae8737f3e767dffcadf1722fbb36a7

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2011-11-10 22:59:24 pgsql: Revert removal of trace_userlocks, because userlocks aren't gone
Previous Message Peter Eisentraut 2011-11-10 20:30:53 pgsql: Fix server header file installation with vpath builds