From da520dcbeb84fef1acbcc2ba8b48a315dedf5464 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sat, 24 Dec 2016 17:21:03 +0000 Subject: Fix bug #31387 - not checking end iterator when parsing decimal escape. Thanks to Karen for the report. llvm-svn: 290500 --- libcxx/include/regex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libcxx/include/regex') diff --git a/libcxx/include/regex b/libcxx/include/regex index 1c4cc1d9abb..5a6c7fbb8e0 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -4314,7 +4314,8 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first, else if ('1' <= *__first && *__first <= '9') { unsigned __v = *__first - '0'; - for (++__first; '0' <= *__first && *__first <= '9'; ++__first) + for (++__first; + __first != __last && '0' <= *__first && *__first <= '9'; ++__first) __v = 10 * __v + *__first - '0'; if (__v > mark_count()) __throw_regex_error(); -- cgit v1.2.3