Reduce recursion limit for auto-possessify to reduce stack usage at compile
time. Fixes oss-fuzz issue 553.
This commit is contained in:
parent
2f1e99e04f
commit
7ab91fdfb2
|
@ -339,6 +339,10 @@ modules.
|
||||||
* numbers 11, 12 & 13 should end in "th";
|
* numbers 11, 12 & 13 should end in "th";
|
||||||
* use double quotes in usage message.
|
* use double quotes in usage message.
|
||||||
|
|
||||||
|
53. When autopossessifying, skip empty branches without recursion, to reduce
|
||||||
|
stack usage for the benefit of clang with -fsanitize-address, which uses huge
|
||||||
|
stack frames. Example pattern: /X?(R||){3335}/. Fixes oss-fuzz issue 553.
|
||||||
|
|
||||||
|
|
||||||
Version 10.22 29-July-2016
|
Version 10.22 29-July-2016
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
|
@ -589,6 +589,7 @@ for(;;)
|
||||||
case OP_ASSERTBACK_NOT:
|
case OP_ASSERTBACK_NOT:
|
||||||
case OP_ONCE:
|
case OP_ONCE:
|
||||||
case OP_ONCE_NC:
|
case OP_ONCE_NC:
|
||||||
|
|
||||||
/* Atomic sub-patterns and assertions can always auto-possessify their
|
/* Atomic sub-patterns and assertions can always auto-possessify their
|
||||||
last iterator. However, if the group was entered as a result of checking
|
last iterator. However, if the group was entered as a result of checking
|
||||||
a previous iterator, this is not possible. */
|
a previous iterator, this is not possible. */
|
||||||
|
@ -606,6 +607,9 @@ for(;;)
|
||||||
next_code = code + GET(code, 1);
|
next_code = code + GET(code, 1);
|
||||||
code += PRIV(OP_lengths)[c];
|
code += PRIV(OP_lengths)[c];
|
||||||
|
|
||||||
|
/* Check each branch. We have to recurse a level for all but the last
|
||||||
|
branch. */
|
||||||
|
|
||||||
while (*next_code == OP_ALT)
|
while (*next_code == OP_ALT)
|
||||||
{
|
{
|
||||||
if (!compare_opcodes(code, utf, cb, base_list, base_end, rec_limit))
|
if (!compare_opcodes(code, utf, cb, base_list, base_end, rec_limit))
|
||||||
|
@ -1067,7 +1071,7 @@ PCRE2_UCHAR c;
|
||||||
PCRE2_SPTR end;
|
PCRE2_SPTR end;
|
||||||
PCRE2_UCHAR *repeat_opcode;
|
PCRE2_UCHAR *repeat_opcode;
|
||||||
uint32_t list[8];
|
uint32_t list[8];
|
||||||
int rec_limit = 10000;
|
int rec_limit = 1000; /* Was 10,000 but clang+ASAN uses a lot of stack. */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5826,4 +5826,9 @@ ef) x/x,mark
|
||||||
/[s[:digit:]\Q\E-H]+/
|
/[s[:digit:]\Q\E-H]+/
|
||||||
s09-H
|
s09-H
|
||||||
|
|
||||||
|
/a+(?:|b)a/
|
||||||
|
aaaa
|
||||||
|
|
||||||
|
/X?(R||){3335}/
|
||||||
|
|
||||||
# End of testinput1
|
# End of testinput1
|
||||||
|
|
|
@ -9305,4 +9305,10 @@ No match
|
||||||
s09-H
|
s09-H
|
||||||
0: s09-H
|
0: s09-H
|
||||||
|
|
||||||
|
/a+(?:|b)a/
|
||||||
|
aaaa
|
||||||
|
0: aaaa
|
||||||
|
|
||||||
|
/X?(R||){3335}/
|
||||||
|
|
||||||
# End of testinput1
|
# End of testinput1
|
||||||
|
|
Loading…
Reference in New Issue