From ae013c447c81b63a120480312a349d869ab8621c Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 31 Aug 2010 11:25:56 +0000 Subject: [PATCH] In Perl mode then "something+++" should be an error. Add the necessary error handling. Fixes #4608. [SVN r65145] --- include/boost/regex/v4/basic_regex_parser.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/boost/regex/v4/basic_regex_parser.hpp b/include/boost/regex/v4/basic_regex_parser.hpp index 172b53a0..6779383e 100644 --- a/include/boost/regex/v4/basic_regex_parser.hpp +++ b/include/boost/regex/v4/basic_regex_parser.hpp @@ -1003,6 +1003,21 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ // if(pocessive) { + if(m_position != m_end) + { + // + // Check for illegal following quantifier, we have to do this here, because + // the extra states we insert below circumvents are 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: + fail(regex_constants::error_badrepeat, m_position - m_base); + return false; + } + } re_brace* pb = static_cast(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace))); pb->index = -3; pb->icase = this->flags() & regbase::icase;