summaryrefslogtreecommitdiffstats
path: root/libcxx/include/regex
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-07-23 18:27:51 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-07-23 18:27:51 +0000
commit983d17810811cdac0ff475049451f48a6da5cb25 (patch)
tree76e5899d25d56ed236d56f7fdbec9e25ff69d335 /libcxx/include/regex
parent3f07e7b06363bf88d70bd89b8d45eabf64caf2b3 (diff)
downloadbcm5719-llvm-983d17810811cdac0ff475049451f48a6da5cb25.tar.gz
bcm5719-llvm-983d17810811cdac0ff475049451f48a6da5cb25.zip
Detect and throw on a class of bad regexes that we mistakenly accepted before. Thanks to Trevor Smigiel for the report
llvm-svn: 243030
Diffstat (limited to 'libcxx/include/regex')
-rw-r--r--libcxx/include/regex8
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 6ac5e1da8c2..698278c6014 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -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;
OpenPOWER on IntegriCloud