Fix zero-repeated assertion-as-condition bug.
This commit is contained in:
parent
f024446c93
commit
eea35d0cab
|
@ -53,4 +53,7 @@ matched against "abcd".
|
|||
|
||||
8. The pcre2_substitute() function has been implemented.
|
||||
|
||||
9. If an assertion condition was quantified with a minimum of zero (an odd
|
||||
thing to do, but it happened), SIGSEGV or other misbehaviour could occur.
|
||||
|
||||
****
|
||||
|
|
|
@ -1401,8 +1401,11 @@ for (;;)
|
|||
condition = TRUE;
|
||||
|
||||
/* Advance ecode past the assertion to the start of the first branch,
|
||||
but adjust it so that the general choosing code below works. */
|
||||
but adjust it so that the general choosing code below works. If the
|
||||
assertion has a quantifier that allows zero repeats we must skip over
|
||||
the BRAZERO. This is a lunatic thing to do, but somebody did! */
|
||||
|
||||
if (*ecode == OP_BRAZERO) ecode++;
|
||||
ecode += GET(ecode, 1);
|
||||
while (*ecode == OP_ALT) ecode += GET(ecode, 1);
|
||||
ecode += 1 + LINK_SIZE - PRIV(OP_lengths)[condcode];
|
||||
|
|
|
@ -4078,4 +4078,10 @@ a random value. /Ix
|
|||
|
||||
# End of substitute tests
|
||||
|
||||
"((?=(?(?=(?(?=(?(?=())))*)))))"
|
||||
a
|
||||
|
||||
"(?(?=)?==)(((((((((?=)))))))))"
|
||||
a
|
||||
|
||||
# End of testinput2
|
||||
|
|
|
@ -13705,4 +13705,14 @@ Failed: error -34: bad option value
|
|||
|
||||
# End of substitute tests
|
||||
|
||||
"((?=(?(?=(?(?=(?(?=())))*)))))"
|
||||
a
|
||||
0:
|
||||
1:
|
||||
2:
|
||||
|
||||
"(?(?=)?==)(((((((((?=)))))))))"
|
||||
a
|
||||
No match
|
||||
|
||||
# End of testinput2
|
||||
|
|
Loading…
Reference in New Issue