regex: re_search etc. should return -2 when memory exhausted
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 27 Feb 2012 07:09:05 +0000 (23:09 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 27 Feb 2012 07:09:43 +0000 (23:09 -0800)
commit0e4e5e4e5e3bd26e637571f7c939715e276700c7
tree81bbe5aedeb7c87ee326b32465ee26c14f24fc46
parent579928caf1c6bb983cbba7ee18603c077be78392
regex: re_search etc. should return -2 when memory exhausted

This bug was uncovered when testing 'grep'.  Without the fix,
re_search and friends return -1 when memory is exhausted, but -1
means no match, and this causes grep to falsely report no-match
instead of memory-exhaustion.  See
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=13762>.
* lib/regexec.c (re_search_stub): Return -2 (not -1) if there is
trouble; this can occur if re_search_internal ran out of memory.
ChangeLog
lib/regexec.c