Fix empty string matching bug.

This commit is contained in:
Philip.Hazel 2015-06-09 17:41:45 +00:00
parent 1e6edd2e33
commit 1d44822484
4 changed files with 26 additions and 2 deletions

View File

@ -151,6 +151,10 @@ overflows.
38. The table entry for \l in EBCDIC environments was incorrect, leading to its
being treated as a literal 'l' instead of causing an error.
39. If a non-capturing group containing a conditional group that could match
an empty string was repeated, it was not identified as matching an empty string
itself. For example: /^(?:(?(1)x|)+)+$()/.
Version 10.10 06-March-2015
---------------------------

View File

@ -1238,7 +1238,7 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
PCRE2_SPTR ccode;
c = *code;
/* Skip over forward assertions; the other assertions are skipped by
first_significant_code() with a TRUE final argument. */
@ -1338,7 +1338,7 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
if (c == OP_BRA || c == OP_BRAPOS ||
c == OP_CBRA || c == OP_CBRAPOS ||
c == OP_ONCE || c == OP_ONCE_NC ||
c == OP_COND)
c == OP_COND || c == OP_SCOND)
{
BOOL empty_branch;
if (GET(code, 1) == 0) return TRUE; /* Hit unclosed bracket */

2
testdata/testinput2 vendored
View File

@ -4325,4 +4325,6 @@ a random value. /Ix
/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
/^(?:(?(1)x|)+)+$()/B
# End of testinput2

18
testdata/testoutput2 vendored
View File

@ -14452,4 +14452,22 @@ Failed: error 162 at offset 4: subpattern name expected
/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
Failed: error 161 at offset 32: number is too big
/^(?:(?(1)x|)+)+$()/B
------------------------------------------------------------------
Bra
^
SBra
SCond
1 Cond ref
x
Alt
KetRmax
KetRmax
$
CBra 1
Ket
Ket
End
------------------------------------------------------------------
# End of testinput2