Fix workspace overflow for deep nested parentheses with (*ACCEPT).
This commit is contained in:
parent
78aff8c80f
commit
6bb132265b
|
@ -58,6 +58,10 @@ some head-scratching the next time this happens.
|
||||||
assertion, caused pcre2test to output a very large number of spaces when the
|
assertion, caused pcre2test to output a very large number of spaces when the
|
||||||
callout was taken, making the program appearing to loop.
|
callout was taken, making the program appearing to loop.
|
||||||
|
|
||||||
|
12. A pattern that included (*ACCEPT) in the middle of a sufficiently deeply
|
||||||
|
nested set of parentheses of sufficient size caused an overflow of the
|
||||||
|
compiling workspace (which was diagnosed, but of course is not desirable).
|
||||||
|
|
||||||
|
|
||||||
Version 10.21 12-January-2016
|
Version 10.21 12-January-2016
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
|
@ -5901,11 +5901,23 @@ for (;; ptr++)
|
||||||
goto FAILED;
|
goto FAILED;
|
||||||
}
|
}
|
||||||
cb->had_accept = TRUE;
|
cb->had_accept = TRUE;
|
||||||
|
|
||||||
|
/* In the first pass, just accumulate the length required;
|
||||||
|
otherwise hitting (*ACCEPT) inside many nested parentheses can
|
||||||
|
cause workspace overflow. */
|
||||||
|
|
||||||
for (oc = cb->open_caps; oc != NULL; oc = oc->next)
|
for (oc = cb->open_caps; oc != NULL; oc = oc->next)
|
||||||
|
{
|
||||||
|
if (lengthptr != NULL)
|
||||||
|
{
|
||||||
|
*lengthptr += CU2BYTES(1) + IMM2_SIZE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
*code++ = OP_CLOSE;
|
*code++ = OP_CLOSE;
|
||||||
PUT2INC(code, 0, oc->number);
|
PUT2INC(code, 0, oc->number);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setverb = *code++ =
|
setverb = *code++ =
|
||||||
(cb->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
|
(cb->assert_depth > 0)? OP_ASSERT_ACCEPT : OP_ACCEPT;
|
||||||
|
|
||||||
|
|
|
@ -182,4 +182,6 @@
|
||||||
|
|
||||||
/((?1)(?2)(?3)(?4)(?5)(?6)(?7)(?8)(?9)(?9)(?8)(?7)(?6)(?5)(?4)(?3)(?2)(?1)(?0)){2,}()()()()()()()()()/debug
|
/((?1)(?2)(?3)(?4)(?5)(?6)(?7)(?8)(?9)(?9)(?8)(?7)(?6)(?5)(?4)(?3)(?2)(?1)(?0)){2,}()()()()()()()()()/debug
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1027,4 +1027,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 186 at offset 490: regular expression is too complicated
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1023,4 +1023,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1023,4 +1023,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1023,4 +1023,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1023,4 +1023,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1023,4 +1023,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1026,4 +1026,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1024,4 +1024,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
|
@ -1022,4 +1022,7 @@ Capturing subpattern count = 10
|
||||||
May match empty string
|
May match empty string
|
||||||
Subject length lower bound = 0
|
Subject length lower bound = 0
|
||||||
|
|
||||||
|
/([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00]([00](*ACCEPT)/
|
||||||
|
Failed: error 114 at offset 509: missing closing parenthesis
|
||||||
|
|
||||||
# End of testinput8
|
# End of testinput8
|
||||||
|
|
Loading…
Reference in New Issue