postgresql/src/include/regex
Tom Lane 9ed207ae99 Add recursion depth protections to regular expression matching.
Some of the functions in regex compilation and execution recurse, and
therefore could in principle be driven to stack overflow.  The Tcl crew
has seen this happen in practice in duptraverse(), though their fix was
to put in a hard-wired limit on the number of recursive levels, which is
not too appetizing --- fortunately, we have enough infrastructure to check
the actually available stack.  Greg Stark has also seen it in other places
while fuzz testing on a machine with limited stack space.  Let's put guards
in to prevent crashes in all these places.

Since the regex code would leak memory if we simply threw elog(ERROR),
we have to introduce an API that checks for stack depth without throwing
such an error.  Fortunately that's not difficult.
2015-10-02 14:51:58 -04:00
..
regcustom.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
regerrs.h Allow regex operations to be terminated early by query cancel requests. 2014-03-01 15:21:00 -05:00
regex.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
regexport.h Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
regguts.h Add recursion depth protections to regular expression matching. 2015-10-02 14:51:58 -04:00