Bug 13762 - re_search etc. should return -2 on memory exhaustion
Summary: re_search etc. should return -2 on memory exhaustion
Status: WAITING
Alias: None
Product: glibc
Classification: Unclassified
Component: regex (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-27 07:06 UTC by Paul Eggert
Modified: 2014-06-26 14:22 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
Fix re_search to return -2 on memory exhaustion. (392 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.
Comment 1 Ondrej Bilka 2013-10-12 20:53:20 UTC
Could you send this to libc-alpha?
Comment 2 Florian Weimer 2014-06-26 14:22:47 UTC
(In reply to Ondrej Bilka from comment #1)
> Could you send this to libc-alpha?

Seconded.