summaryrefslogtreecommitdiffstats
path: root/include/regex
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-08-24 15:57:09 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-08-24 15:57:09 +0000
commit70e8f5988476c4ef3f8d0296d03a1f97380de212 (patch)
treea3c508f148b85492972b7101ce4e8e09841edfb9 /include/regex
parentbb2f28e15d3666b9316bf77ced071f16fa0fc70e (diff)
downloadexternal_libcxx-70e8f5988476c4ef3f8d0296d03a1f97380de212.tar.gz
external_libcxx-70e8f5988476c4ef3f8d0296d03a1f97380de212.tar.bz2
external_libcxx-70e8f5988476c4ef3f8d0296d03a1f97380de212.zip
Fix a crasher found by libFuzzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/regex')
-rw-r--r--include/regex2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/regex b/include/regex
index b355bbb3a..b2b556e5b 100644
--- a/include/regex
+++ b/include/regex
@@ -1733,6 +1733,8 @@ template <class _CharT>
void
__back_ref<_CharT>::__exec(__state& __s) const
{
+ if (__mexp_ > __s.__sub_matches_.size())
+ __throw_regex_error<regex_constants::error_backref>();
sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
if (__sm.matched)
{