Fix some possible low-memory failures in regexp compilation.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: a54875602a057f8ee0cf5e880bfe2056b5dd11f0
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-08-12T04:48:39Z
Releases: 9.3.10
Fix some possible low-memory failures in regexp compilation.

newnfa() failed to set the regex error state when malloc() fails.
Several places in regcomp.c failed to check for an error after calling
subre().  Each of these mistakes could lead to null-pointer-dereference
crashes in memory-starved backends.

Report and patch by Andreas Seltenreich.  Back-patch to all branches.

Files

PathChange+/−
src/backend/regex/regc_nfa.c modified +3 −0
src/backend/regex/regcomp.c modified +3 −0