9260afc35b5ed408e673ba526c7762a1ef4f6103
[boost.git] / boost-regex.patch
1 *** boost/regex/v4/basic_regex_parser.hpp.orig  2008-01-14 12:53:01.000000000 -0600
2 --- boost/regex/v4/basic_regex_parser.hpp       2008-01-14 12:57:25.000000000 -0600
3 *************** bool basic_regex_parser<charT, traits>::
4 *** 777,782 ****
5 --- 777,783 ----
6         case syntax_element_restart_continue:
7         case syntax_element_jump:
8         case syntax_element_startmark:
9 +       case syntax_element_backstep:
10            // can't legally repeat any of the above:
11            fail(regex_constants::error_badrepeat, m_position - m_base);
12            return false;
13 *************** bool basic_regex_parser<charT, traits>::
14 *** 1862,1867 ****
15 --- 1863,1869 ----
16      if(markid == -4)
17      {
18         re_syntax_base* b = this->getaddress(expected_alt_point);
19 +       // Make sure we have exactly one alternative following this state:
20         if(b->type != syntax_element_alt)
21         {
22            re_alt* alt = static_cast<re_alt*>(this->insert_state(expected_alt_point, syntax_element_alt, sizeof(re_alt)));
23 *************** bool basic_regex_parser<charT, traits>::
24 *** 1872,1877 ****
25 --- 1874,1888 ----
26            fail(regex_constants::error_bad_pattern, m_position - m_base);
27            return false;
28         }
29 +       // check for invalid repetition of next state:
30 +       b = this->getaddress(expected_alt_point);
31 +       b = this->getaddress(static_cast<re_alt*>(b)->next.i, b);
32 +       if((b->type != syntax_element_assert_backref)
33 +          && (b->type != syntax_element_startmark))
34 +       {
35 +          fail(regex_constants::error_badrepeat, m_position - m_base);
36 +          return false;
37 +       }
38      }
39      //
40      // append closing parenthesis state: