From: Paul Eggert Date: Thu, 6 Sep 2018 06:57:08 +0000 (-0700) Subject: regex: fix storage-exhaustion error X-Git-Tag: glibc-2.29~194 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef202e530c2384d6a47951ed1c6b63ed945e462f;p=thirdparty%2Fglibc.git regex: fix storage-exhaustion error [BZ #18040] * posix/regexec.c (get_subexp): Do not continue if storage is exhausted. --- diff --git a/ChangeLog b/ChangeLog index 2fef13ec02c..e0e7a74011a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-12-15 Paul Eggert + + regex: fix storage-exhaustion error + [BZ #18040] + * posix/regexec.c (get_subexp): + Do not continue if storage is exhausted. + 2018-12-15 Assaf Gordon regex: fix heap-use-after-free error diff --git a/posix/regexec.c b/posix/regexec.c index a29e8ad1ff3..ecb430d3023 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -2786,6 +2786,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 (__glibc_unlikely (err != REG_NOERROR)) + return err; } } return REG_NOERROR;