summaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-09-05 23:57:08 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-12-16 07:08:29 -0800
commitef202e530c2384d6a47951ed1c6b63ed945e462f (patch)
tree891f998913622e9578bedf7dc922551b63669e6d /posix
parentregex: fix heap-use-after-free error (diff)
downloadglibc-ef202e530c2384d6a47951ed1c6b63ed945e462f.tar.gz
glibc-ef202e530c2384d6a47951ed1c6b63ed945e462f.tar.bz2
glibc-ef202e530c2384d6a47951ed1c6b63ed945e462f.zip
regex: fix storage-exhaustion error
[BZ #18040] * posix/regexec.c (get_subexp): Do not continue if storage is exhausted.
Diffstat (limited to 'posix')
-rw-r--r--posix/regexec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/posix/regexec.c b/posix/regexec.c
index a29e8ad1ff..ecb430d302 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;