Bug 24844 - regex bad pointer / leakage if malloc fails
Summary: regex bad pointer / leakage if malloc fails
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: regex (show other bugs)
Version: 2.29
: P2 normal
Target Milestone: 2.31
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-23 19:20 UTC by eggert
Modified: 2019-08-21 18:05 UTC (History)
2 users (show)

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


Attachments
Patch for bad pointer / leak in regex_internal.c (800 bytes, patch)
2019-07-23 19:20 UTC, eggert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eggert 2019-07-23 19:20:49 UTC
Created attachment 11919 [details]
Patch for bad pointer / leak in regex_internal.c

regex_internal.c mistreats malloc failures in a couple of places. In one, it dereferences the resulting NULL pointer; in the other, it leaks another block of memory when an malloc fails. The latter problem was found by Coverity. Proposed patch attached.
Comment 1 Carlos O'Donell 2019-07-23 19:29:23 UTC
(In reply to eggert from comment #0)
> Created attachment 11919 [details]
> Patch for bad pointer / leak in regex_internal.c
> 
> regex_internal.c mistreats malloc failures in a couple of places. In one, it
> dereferences the resulting NULL pointer; in the other, it leaks another
> block of memory when an malloc fails. The latter problem was found by
> Coverity. Proposed patch attached.

Please post to libc-alpha if you think this should be fixed for 2.30.
Comment 2 eggert 2019-08-21 18:05:19 UTC
I installed the patch and am closing the bug report.