forked from boostorg/regex
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:
@ -908,6 +908,7 @@ void test_recursion()
|
||||
// Bugs:
|
||||
TEST_REGEX_SEARCH("namespace\\s+(\\w+)\\s+(\\{(?:[^{}]*(?:(?2)[^{}]*)*)?\\})", perl, "namespace one { namespace two { int foo(); } }", match_default, make_array(0, 46, 10, 13, 14, 46, -2, -2));
|
||||
TEST_REGEX_SEARCH("namespace\\s+(\\w+)\\s+(\\{(?:[^{}]*(?:(?2)[^{}]*)*)?\\})", perl, "namespace one { namespace two { int foo(){} } { {{{ } } } } {}}", match_default, make_array(0, 64, 10, 13, 14, 64, -2, -2));
|
||||
TEST_INVALID_REGEX("((?1)|a)", perl);
|
||||
|
||||
// Recursion to a named sub with a name that is used multiple times:
|
||||
TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.(?&A)", perl, "aaaa.aa", match_default, make_array(0, 7, 0, 4, -1, -1, -2, -2));
|
||||
|
@ -477,6 +477,9 @@ void test_pocessive_repeats()
|
||||
TEST_REGEX_SEARCH("x{1,4}+\\w", perl, "xxxxxa", match_default, make_array(0, 5, -2, -2));
|
||||
TEST_REGEX_SEARCH("x{1,3}+\\w", perl, "xxxxxa", match_default, make_array(0, 4, -2, 4, 6, -2, -2));
|
||||
TEST_INVALID_REGEX("\\d+++", perl);
|
||||
TEST_INVALID_REGEX("\\d++*", perl);
|
||||
TEST_INVALID_REGEX("\\d++?", perl);
|
||||
TEST_INVALID_REGEX("\\d++{3}", perl);
|
||||
TEST_INVALID_REGEX("\\d*++", perl);
|
||||
TEST_INVALID_REGEX("\\d?++", perl);
|
||||
TEST_INVALID_REGEX("\\d{1,2}++", perl);
|
||||
|
Reference in New Issue
Block a user