Fix infinite recursion in bad recursive expressions.

Fix bug that allows invalid regex to go unnoticed and crash later.
Fixes #5613.
Fixes #5612.

[SVN r72612]
This commit is contained in:
John Maddock
2011-06-16 11:27:13 +00:00
parent 6c181b02ba
commit fbf5c7d62c
4 changed files with 24 additions and 6 deletions

View File

@ -1026,13 +1026,14 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
{
//
// Check for illegal following quantifier, we have to do this here, because
// the extra states we insert below circumvents are usual error checking :-(
// the extra states we insert below circumvents our usual error checking :-(
//
switch(this->m_traits.syntax_type(*m_position))
{
case regex_constants::syntax_star:
case regex_constants::syntax_plus:
case regex_constants::syntax_question:
case regex_constants::syntax_open_brace:
fail(regex_constants::error_badrepeat, m_position - m_base);
return false;
}