public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
From: "makovick at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs-regex@sourceware.org
Subject: [Bug regex/14780] [PATCH] handle malloc() and realloc() failures in regcomp()
Date: Thu, 12 Sep 2013 17:21:00 -0000	[thread overview]
Message-ID: <bug-14780-132-CibGviXmkY@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14780-132@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=14780

--- Comment #7 from Jindrich Makovicka <makovick at gmail dot com> ---
(In reply to Rich Felker from comment #6)
> Are there any actual cases where malloc failure is not checked? I reviewed
> regcomp.c briefly and it seems the result is eventually (just not
> immediately) checked before use. However, there are major leaks when malloc
> has failed, since multiple results are checked together and no effort is
> made to free the ones that did succeed.

I do not really recall anymore if there _really_ was a segfault, or it was only
caused when I tried to free such partially compiled regex using regfree(). But
you can insert the fuzzing code from the first patch, consisting of xxmalloc
and xxrealloc from regcomp.c and #defines from regcomp.h, and run the attached
testcase with, say, 100000 iterations and look what happens.

The memory leaks are obviously real, and were the main reason I was looking
into this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2013-09-12 17:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-28 13:27 [Bug regex/14780] New: " makovick at gmail dot com
2012-10-28 13:28 ` [Bug regex/14780] " makovick at gmail dot com
2012-10-28 13:28 ` makovick at gmail dot com
2012-10-28 13:29 ` makovick at gmail dot com
2012-10-28 14:42 ` makovick at gmail dot com
2013-01-17 14:10 ` siddhesh at redhat dot com
2013-09-12  3:26 ` bugdal at aerifal dot cx
2013-09-12 17:21 ` makovick at gmail dot com [this message]
2013-09-14 16:50 ` bugdal at aerifal dot cx
2013-10-14 16:10 ` neleai at seznam dot cz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14780-132-CibGviXmkY@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs-regex@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).