Ticket #4132: patchfile.patch
File patchfile.patch, 2.9 KB (added by , 13 years ago) |
---|
-
basic_regex_creator.hpp
769 769 case syntax_element_assert_backref: 770 770 { 771 771 // just check that the index is valid: 772 int id = static_cast<const re_brace*>(state)->index;773 if(id < 0)772 int idx = static_cast<const re_brace*>(state)->index; 773 if(idx < 0) 774 774 { 775 id = -id-1;776 if(id >= 10000)775 idx = -idx-1; 776 if(idx >= 10000) 777 777 { 778 id = m_pdata->get_id(id);779 if(id <= 0)778 idx = m_pdata->get_id(idx); 779 if(idx <= 0) 780 780 { 781 781 // check of sub-expression that doesn't exist: 782 782 if(0 == this->m_pdata->m_status) // update the error code if not already set … … 804 804 { 805 805 bool ok = false; 806 806 re_syntax_base* p = base; 807 std::ptrdiff_t id = static_cast<re_jump*>(state)->alt.i;808 if(id > 10000)809 id = m_pdata->get_id(id);807 std::ptrdiff_t idx = static_cast<re_jump*>(state)->alt.i; 808 if(idx > 10000) 809 idx = m_pdata->get_id(idx); 810 810 while(p) 811 811 { 812 if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == id ))812 if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idx)) 813 813 { 814 814 // 815 815 // We've found the target of the recursion, set the jump target: … … 833 833 next_rep_id = static_cast<re_repeat*>(p)->state_id; 834 834 break; 835 835 case syntax_element_endmark: 836 if(static_cast<const re_brace*>(p)->index == id )836 if(static_cast<const re_brace*>(p)->index == idx) 837 837 next_rep_id = -1; 838 838 break; 839 839 default: -
perl_matcher_common.hpp
732 732 { 733 733 // Have we recursed into subexpression "index"? 734 734 // If index == 0 then check for any recursion at all, otherwise for recursion to -index-1. 735 int id = -index-1;736 if(id >= 10000)737 id = re.get_data().get_id(id);738 result = !recursion_stack.empty() && ((recursion_stack.back().id == id) || (index == 0));735 int idx = -index-1; 736 if(idx >= 10000) 737 idx = re.get_data().get_id(idx); 738 result = !recursion_stack.empty() && ((recursion_stack.back().idx == idx) || (index == 0)); 739 739 pstate = pstate->next.p; 740 740 } 741 741 return result;