Regex: Fix handling of repeats when mod_x is in effect.

See https://oss-fuzz.com/v2/testcase-detail/6420486177161216?noredirect=1
This commit is contained in:
jzmaddock
2017-10-08 11:52:54 +01:00
parent dc74e145d9
commit f343cab680
2 changed files with 23 additions and 1 deletions

View File

@ -486,5 +486,15 @@ void test_pocessive_repeats()
TEST_INVALID_REGEX("\\d*++", perl);
TEST_INVALID_REGEX("\\d?++", perl);
TEST_INVALID_REGEX("\\d{1,2}++", perl);
TEST_REGEX_SEARCH("(ab +)", perl|mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
TEST_REGEX_SEARCH("(ab +?)", perl | mod_x, "abbb", match_default, make_array(0, 2, 0, 2, -2, -2));
TEST_REGEX_SEARCH("(ab + ?)", perl | mod_x, "abbb", match_default, make_array(0, 2, 0, 2, -2, -2));
TEST_REGEX_SEARCH("(ab ++)", perl | mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
TEST_REGEX_SEARCH("(ab + +)", perl | mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
TEST_INVALID_REGEX("(ab + ++)", perl | mod_x);
TEST_INVALID_REGEX("(ab + + +)", perl | mod_x);
TEST_INVALID_REGEX("(ab + + ?)", perl | mod_x);
}