Fix a crasher found by libFuzzer

llvm-svn: 245849
diff --git a/libcxx/include/regex b/libcxx/include/regex
index b355bbb..b2b556e 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1733,6 +1733,8 @@
 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)
     {