re_search out-of-memory patch
Commit Message
Attached is a patch I'm proposing here by popular request, taken from
BZ#13762.
2012-02-27 Paul Eggert <eggert@cs.ucla.edu>
* posix/regexec.c (re_search_stub): Return -2, not -1, on
memory exhaustion.
@@ -466,7 +466,7 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len)
/* I hope we needn't fill ther regs with -1's when no match was found. */
if (result != REG_NOERROR)
- rval = -1;
+ rval = result == REG_NOMATCH ? -1 : -2;
else if (regs != NULL)
{
/* If caller wants register contents data back, copy them. */