Bug 13762 - re_search etc. should return -2 on memory exhaustion
re_search etc. should return -2 on memory exhaustion
Status: NEW
Product: glibc
Classification: Unclassified
Component: regex
unspecified
: P2 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-27 07:06 UTC by Paul Eggert
Modified: 2012-02-27 07:06 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Fix re_search to return -2 on memory exhaustion. (615 bytes, text/plain)
2012-02-27 07:06 UTC, Paul Eggert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggert 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.