Sources Bugzilla – Bug 13762
re_search etc. should return -2 on memory exhaustion
Last modified: 2012-02-27 07:06:59 UTC
Created attachment 6249 [details]
Fix re_search to return -2 on memory exhaustion.
I ran into this problem when testing GNU grep, which uses
the re_search function. re_search is supposed to return -2
on internal error, but it returns -1 in some cases when
memory is exhausted. -1 simply means "no match", so this
causes grep to falsely claim "no match" when it should have
reported an error due to memory exhaustion.
I'm attaching a patch against the current git master.