Fix mutual recursion inside other parentheses stack overflow bug.
This commit is contained in:
parent
625fd31e3e
commit
1a1781e0c9
@ -37,6 +37,10 @@ interacting badly with the code for computing the amount of space needed to
|
||||
compile the pattern, leading to a buffer overflow. This bug was discovered by
|
||||
the LLVM fuzzer.
|
||||
|
||||
10. A pattern such as /((?2)+)((?1))/ which has mutual recursion nested inside
|
||||
other kinds of group caused stack overflow at compile time. This bug was
|
||||
discovered by the LLVM fuzzer.
|
||||
|
||||
|
||||
Version 10.10 06-March-2015
|
||||
---------------------------
|
||||
|
@ -1331,8 +1331,8 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
|
||||
empty_branch = FALSE;
|
||||
do
|
||||
{
|
||||
if (!empty_branch && could_be_empty_branch(code, endcode, utf, cb, NULL))
|
||||
empty_branch = TRUE;
|
||||
if (!empty_branch && could_be_empty_branch(code, endcode, utf, cb,
|
||||
recurses)) empty_branch = TRUE;
|
||||
code += GET(code, 1);
|
||||
}
|
||||
while (*code == OP_ALT);
|
||||
|
5
testdata/testinput2
vendored
5
testdata/testinput2
vendored
@ -4236,4 +4236,9 @@ a random value. /Ix
|
||||
** Failers
|
||||
aaa
|
||||
|
||||
# JIT gives a different error message for the infinite recursion
|
||||
|
||||
"(*NO_JIT)((?2)+)((?1)){"
|
||||
abcd{
|
||||
|
||||
# End of testinput2
|
||||
|
6
testdata/testoutput2
vendored
6
testdata/testoutput2
vendored
@ -14198,4 +14198,10 @@ No match
|
||||
aaa
|
||||
No match
|
||||
|
||||
# JIT gives a different error message for the infinite recursion
|
||||
|
||||
"(*NO_JIT)((?2)+)((?1)){"
|
||||
abcd{
|
||||
Failed: error -52: nested recursion at the same subject position
|
||||
|
||||
# End of testinput2
|
||||
|
Loading…
Reference in New Issue
Block a user