summaryrefslogtreecommitdiffstats
path: root/libcxx/include/regex
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/regex')
-rw-r--r--libcxx/include/regex2
1 files changed, 2 insertions, 0 deletions
diff --git a/libcxx/include/regex b/libcxx/include/regex
index b355bbb3ac4..b2b556e5bc4 100644
--- a/libcxx/include/regex
+++ b/libcxx/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)
{
OpenPOWER on IntegriCloud