Detect and throw on a class of bad regexes that we mistakenly accepted before. Thanks to Trevor Smigiel for the report

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243030 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2015-07-23 18:27:51 +00:00
parent 3a59ae6783
commit 568bd0222f
3 changed files with 51 additions and 1 deletions

View File

@@ -4305,6 +4305,14 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
}
}
break;
case '*':
case '+':
case '?':
case '{':
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::error_badrepeat);
#endif
break;
default:
__first = __parse_pattern_character(__first, __last);
break;