This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] regex: fix storage-exhaustion error


[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]