Ensure all match limit tests set a limit, don't rely on the default.
This commit is contained in:
parent
fb15b37b2c
commit
3fb01b0443
|
@ -63,6 +63,10 @@ matches for the ovector, no matches were displayed.
|
|||
14. Removed an occurrence of ctrl/Z from test 6 because Windows treats it as
|
||||
EOF. The test looks to have come from a fuzzer.
|
||||
|
||||
15. If PCRE2 was built with a default match limit a lot greater than the
|
||||
default default of 10 000 000, some JIT tests of the match limit no longer
|
||||
failed. All such tests now set 10 000 000 as the upper limit.
|
||||
|
||||
|
||||
Version 10.31 12-February-2018
|
||||
------------------------------
|
||||
|
|
|
@ -1331,8 +1331,9 @@ static int regression_tests(void)
|
|||
ovector8_2[i] = -2;
|
||||
}
|
||||
if (re8) {
|
||||
(void)pcre2_set_match_limit_8(mcontext8, 10000000);
|
||||
return_value8[1] = pcre2_match_8(re8, (PCRE2_SPTR8)current->input, strlen(current->input),
|
||||
current->start_offset & OFFSET_MASK, current->match_options, mdata8_2, NULL);
|
||||
current->start_offset & OFFSET_MASK, current->match_options, mdata8_2, mcontext8);
|
||||
|
||||
if (pcre2_jit_compile_8(re8, jit_compile_mode)) {
|
||||
printf("\n8 bit: JIT compiler does not support \"%s\"\n", current->pattern);
|
||||
|
@ -1375,8 +1376,9 @@ static int regression_tests(void)
|
|||
else
|
||||
length16 = copy_char8_to_char16((PCRE2_SPTR8)current->input, regtest_buf16, REGTEST_MAX_LENGTH16);
|
||||
|
||||
(void)pcre2_set_match_limit_16(mcontext16, 10000000);
|
||||
return_value16[1] = pcre2_match_16(re16, regtest_buf16, length16,
|
||||
current->start_offset & OFFSET_MASK, current->match_options, mdata16_2, NULL);
|
||||
current->start_offset & OFFSET_MASK, current->match_options, mdata16_2, mcontext16);
|
||||
|
||||
if (pcre2_jit_compile_16(re16, jit_compile_mode)) {
|
||||
printf("\n16 bit: JIT compiler does not support \"%s\"\n", current->pattern);
|
||||
|
@ -1419,8 +1421,9 @@ static int regression_tests(void)
|
|||
else
|
||||
length32 = copy_char8_to_char32((PCRE2_SPTR8)current->input, regtest_buf32, REGTEST_MAX_LENGTH32);
|
||||
|
||||
(void)pcre2_set_match_limit_32(mcontext32, 10000000);
|
||||
return_value32[1] = pcre2_match_32(re32, regtest_buf32, length32,
|
||||
current->start_offset & OFFSET_MASK, current->match_options, mdata32_2, NULL);
|
||||
current->start_offset & OFFSET_MASK, current->match_options, mdata32_2, mcontext32);
|
||||
|
||||
if (pcre2_jit_compile_32(re32, jit_compile_mode)) {
|
||||
printf("\n32 bit: JIT compiler does not support \"%s\"\n", current->pattern);
|
||||
|
|
|
@ -46,32 +46,45 @@
|
|||
/(*LIMIT_DEPTH=4294967280)abc/I
|
||||
|
||||
/(a+)*zz/
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=3000
|
||||
|
||||
/(a+)*zz/
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=depth_limit=10
|
||||
|
||||
/(*LIMIT_MATCH=3000)(a+)*zz/I
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=60000
|
||||
|
||||
/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
|
||||
/(*LIMIT_MATCH=60000)(a+)*zz/I
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=3000
|
||||
|
||||
/(*LIMIT_DEPTH=10)(a+)*zz/I
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=depth_limit=1000
|
||||
|
||||
/(*LIMIT_DEPTH=10)(*LIMIT_DEPTH=1000)(a+)*zz/I
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
|
||||
/(*LIMIT_DEPTH=1000)(a+)*zz/I
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=depth_limit=10
|
||||
|
||||
# These three have infinitely nested recursions.
|
||||
|
|
|
@ -160,10 +160,13 @@
|
|||
aaaaaaaaaaaaaz\=match_limit=3000
|
||||
|
||||
/(*LIMIT_MATCH=3000)(a+)*zz/I
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=60000
|
||||
|
||||
/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
|
||||
/(*LIMIT_MATCH=60000)(a+)*zz/I
|
||||
|
@ -175,12 +178,15 @@
|
|||
# These three have infinitely nested recursions.
|
||||
|
||||
/((?2))((?1))/
|
||||
\= Expect JIT stack limit reached
|
||||
abc
|
||||
|
||||
/((?(R2)a+|(?1)b))()/
|
||||
\= Expect JIT stack limit reached
|
||||
aaaabcde
|
||||
|
||||
/(?(R)a*(?1)|((?R))b)/
|
||||
\= Expect JIT stack limit reached
|
||||
aaaabcde
|
||||
|
||||
# Invalid options disable JIT when called via pcre2_match(), causing the
|
||||
|
@ -277,7 +283,8 @@
|
|||
/[axm]{7}/
|
||||
|
||||
/(.|.)*?bx/
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax\=match_limit=10000000
|
||||
|
||||
# Test JIT disable
|
||||
|
||||
|
|
|
@ -4938,6 +4938,7 @@
|
|||
abcde\=aftertext
|
||||
|
||||
/(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor
|
||||
\= Expect limit exceeded
|
||||
.*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););
|
||||
|
||||
/\n/firstline
|
||||
|
|
|
@ -124,12 +124,15 @@ Last code unit = 'c'
|
|||
Subject length lower bound = 3
|
||||
|
||||
/(a+)*zz/
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
No match
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=3000
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
/(a+)*zz/
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=depth_limit=10
|
||||
Failed: error -53: matching depth limit exceeded
|
||||
|
||||
|
@ -139,8 +142,10 @@ Match limit = 3000
|
|||
Starting code units: a z
|
||||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
Failed: error -47: match limit exceeded
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=60000
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
|
@ -150,6 +155,7 @@ Match limit = 3000
|
|||
Starting code units: a z
|
||||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
|
@ -159,8 +165,10 @@ Match limit = 60000
|
|||
Starting code units: a z
|
||||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
No match
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=3000
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
|
@ -170,8 +178,10 @@ Depth limit = 10
|
|||
Starting code units: a z
|
||||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
Failed: error -53: matching depth limit exceeded
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=depth_limit=1000
|
||||
Failed: error -53: matching depth limit exceeded
|
||||
|
||||
|
@ -181,6 +191,7 @@ Depth limit = 1000
|
|||
Starting code units: a z
|
||||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
No match
|
||||
|
||||
|
@ -190,8 +201,10 @@ Depth limit = 1000
|
|||
Starting code units: a z
|
||||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
\= Expect no match
|
||||
aaaaaaaaaaaaaz
|
||||
No match
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=depth_limit=10
|
||||
Failed: error -53: matching depth limit exceeded
|
||||
|
||||
|
|
|
@ -300,8 +300,10 @@ Starting code units: a z
|
|||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
JIT compilation was successful
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
Failed: error -47: match limit exceeded
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz\=match_limit=60000
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
|
@ -312,6 +314,7 @@ Starting code units: a z
|
|||
Last code unit = 'z'
|
||||
Subject length lower bound = 2
|
||||
JIT compilation was successful
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaz
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
|
@ -332,14 +335,17 @@ Failed: error -47: match limit exceeded
|
|||
# These three have infinitely nested recursions.
|
||||
|
||||
/((?2))((?1))/
|
||||
\= Expect JIT stack limit reached
|
||||
abc
|
||||
Failed: error -46: JIT stack limit reached
|
||||
|
||||
/((?(R2)a+|(?1)b))()/
|
||||
\= Expect JIT stack limit reached
|
||||
aaaabcde
|
||||
Failed: error -46: JIT stack limit reached
|
||||
|
||||
/(?(R)a*(?1)|((?R))b)/
|
||||
\= Expect JIT stack limit reached
|
||||
aaaabcde
|
||||
Failed: error -46: JIT stack limit reached
|
||||
|
||||
|
@ -516,7 +522,8 @@ Failed: error -46: JIT stack limit reached
|
|||
/[axm]{7}/
|
||||
|
||||
/(.|.)*?bx/
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
|
||||
\= Expect limit exceeded
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax\=match_limit=10000000
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
# Test JIT disable
|
||||
|
|
|
@ -7761,6 +7761,7 @@ No match
|
|||
0+
|
||||
|
||||
/(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor
|
||||
\= Expect limit exceeded
|
||||
.*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00\x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););
|
||||
Failed: error -47: match limit exceeded
|
||||
|
||||
|
|
Loading…
Reference in New Issue