Skip site navigation (1) Skip section navigation (2)

pgsql: Prevent corner-case core dump in rfree().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Prevent corner-case core dump in rfree().
Date: 2012-07-15 17:29:13
Message-ID: E1SqSd7-0004Pn-TR@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Prevent corner-case core dump in rfree().

rfree() failed to cope with the case that pg_regcomp() had initialized the
regex_t struct but then failed to allocate any memory for re->re_guts (ie,
the first malloc call in pg_regcomp() failed).  It would try to touch the
guts struct anyway, and thus dump core.  This is a sufficiently narrow
corner case that it's not surprising it's never been seen in the field;
but still a bug is a bug, so patch all active branches.

Noted while investigating whether we need to call pg_regfree after a
failure return from pg_regcomp.  Other than this bug, it turns out we
don't, so adjust comments appropriately.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/54fd196ffc6432b62fe075e564f457db64fb288c

Modified Files
--------------
src/backend/regex/regcomp.c    |   24 +++++++++++++++---------
src/backend/utils/adt/regexp.c |    3 +--
2 files changed, 16 insertions(+), 11 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-07-15 17:29:14
Subject: pgsql: Prevent corner-case core dump in rfree().
Previous:From: Heikki LinnakangasDate: 2012-07-14 18:30:51
Subject: pgsql: Don't initialize TLI variable to -1, as TimeLineID is unsigned.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group