mirror of
https://github.com/boostorg/regex.git
synced 2025-07-23 09:07:25 +02:00
Correct stack unwinding inside recursions when seeing (*SKIP).
Fixes https://github.com/boostorg/regex/issues/152.
This commit is contained in:
@ -417,7 +417,8 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
{
|
||||
// Must be unwinding from a COMMIT/SKIP/PRUNE and the independent
|
||||
// sub failed, need to unwind everything else:
|
||||
while(unwind(false));
|
||||
while (m_backup_state->state_id)
|
||||
unwind(false);
|
||||
return false;
|
||||
}
|
||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||
|
@ -1000,6 +1000,9 @@ void test_verbs()
|
||||
TEST_REGEX_SEARCH("AA+(*SKIP)(B|Z)|AC", perl, "AAAC", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("AA+(*SKIP)B|C", perl, "AAAC", match_default, make_array(3, 4, -2, -2));
|
||||
|
||||
// https://github.com/boostorg/regex/issues/152
|
||||
TEST_REGEX_SEARCH("\\A((\x1f((?1) )?+)?+(*SKIP) *?(?2)*?)\\z", perl, "\x20\x1f\x1f\x20", match_default, make_array(-2, -2));
|
||||
|
||||
TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "aaaxxxxxx", match_default, make_array(0, 9, -2, -2));
|
||||
TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "aaa++++++", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("^(?:aaa(*THEN)\\w{6}|bbb(*THEN)\\w{5}|ccc(*THEN)\\w{4}|\\w{3})", perl, "bbbxxxxx", match_default, make_array(0, 8, -2, -2));
|
||||
|
Reference in New Issue
Block a user