de-fuzz: need to fail when a named recursive subexpression refers to an invalid name.

This commit is contained in:
jzmaddock
2017-02-23 09:30:49 +00:00
parent 555bedc97d
commit 982f3bbe45

View File

@ -801,6 +801,12 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
// //
idx = m_pdata->get_id(static_cast<int>(idx)); idx = m_pdata->get_id(static_cast<int>(idx));
} }
if(idx < 0)
{
ok = false;
}
else
{
while(p) while(p)
{ {
if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idx)) if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idx))
@ -846,6 +852,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
} }
p = p->next.p; p = p->next.p;
} }
}
if(!ok) if(!ok)
{ {
// recursion to sub-expression that doesn't exist: // recursion to sub-expression that doesn't exist: