public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: libc-alpha@sourceware.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 2/2] regex: fix storage-exhaustion error
Date: Sun, 09 Sep 2018 15:12:00 -0000	[thread overview]
Message-ID: <20180909151207.2903-2-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20180909151207.2903-1-eggert@cs.ucla.edu>
In-Reply-To: <48cb516b-dc86-f174-9abb-4df06f05f845@cs.ucla.edu>

[BZ #23610][BZ #18040]
* posix/regexec.c (get_subexp):
Do not continue if storage is exhausted.
---
 ChangeLog       | 7 +++++++
 posix/regexec.c | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index cf69a33d73..0d865c4eae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-09-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+	regex: fix storage-exhaustion error
+	[BZ #23609][BZ #18040]
+	* posix/regexec.c (get_subexp):
+	Do not continue if storage is exhausted.
+
 2018-09-09  Assaf Gordon  <assafgordon@gmail.com>
 
 	regex: fix heap-use-after-free error
diff --git a/posix/regexec.c b/posix/regexec.c
index 61a4ea26d1..0bef862dca 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -2780,6 +2780,8 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, Idx bkref_str_idx)
 	  buf = (const char *) re_string_get_buffer (&mctx->input);
 	  if (err == REG_NOMATCH)
 	    continue;
+	  if (BE (err != REG_NOERROR, 0))
+	    return err;
 	}
     }
   return REG_NOERROR;
-- 
2.17.1

      parent reply	other threads:[~2018-09-09 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b4246051-d6d3-e984-e1cd-9486250e19ec@gmail.com>
     [not found] ` <2ffa6787-eb96-ab53-e69d-372d7e7ebcc4@cs.ucla.edu>
2018-09-09 15:09   ` regex fixes coming Paul Eggert
2018-09-09 15:12     ` [PATCH 1/2] regex: fix heap-use-after-free error Paul Eggert
2018-09-09 15:12     ` Paul Eggert [this message]

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=20180909151207.2903-2-eggert@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=libc-alpha@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).