Fix bad auto-possessification of certain types of class.

This commit is contained in:
Philip.Hazel 2018-08-17 14:45:35 +00:00
parent 91a6a3a521
commit 6e6bb40a3d
4 changed files with 28 additions and 2 deletions

View File

@ -160,6 +160,11 @@ fields (that is, all the fields that contain pointers) to zeros so that the
result of serializing is always the same. These fields are re-set when the result of serializing is always the same. These fields are re-set when the
pattern is deserialized. pattern is deserialized.
35. In a pattern such as /[^\x{100}-\x{ffff}]*[\x80-\xff]/ which has a repeated
negative class with no characters less than 0x100 followed by a positive class
with only characters less than 0x100, the first class was incorrectly being
auto-possessified, causing incorrect match failures.
Version 10.31 12-February-2018 Version 10.31 12-February-2018
------------------------------ ------------------------------

View File

@ -505,7 +505,7 @@ Arguments:
utf TRUE in UTF mode utf TRUE in UTF mode
cb compile data block cb compile data block
base_list the data list of the base opcode base_list the data list of the base opcode
base_end the end of the data list base_end the end of the base opcode
rec_limit points to recursion depth counter rec_limit points to recursion depth counter
Returns: TRUE if the auto-possessification is possible Returns: TRUE if the auto-possessification is possible
@ -730,7 +730,7 @@ for(;;)
if ((*xclass_flags & XCL_MAP) == 0) if ((*xclass_flags & XCL_MAP) == 0)
{ {
/* No bits are set for characters < 256. */ /* No bits are set for characters < 256. */
if (list[1] == 0) return TRUE; if (list[1] == 0) return (*xclass_flags & XCL_NOT) == 0;
/* Might be an empty repeat. */ /* Might be an empty repeat. */
continue; continue;
} }

9
testdata/testinput4 vendored
View File

@ -2309,4 +2309,13 @@
# ------- # -------
/[^\x{100}-\x{ffff}]*[\x80-\xff]/utf
\x{99}\x{99}\x{99}
/[^\x{100}-\x{ffff}ABC]*[\x80-\xff]/utf
\x{99}\x{99}\x{99}
/[^\x{100}-\x{ffff}]*[\x80-\xff]/i,utf
\x{99}\x{99}\x{99}
# End of testinput4 # End of testinput4

12
testdata/testoutput4 vendored
View File

@ -3730,4 +3730,16 @@ No match
# ------- # -------
/[^\x{100}-\x{ffff}]*[\x80-\xff]/utf
\x{99}\x{99}\x{99}
0: \x{99}\x{99}\x{99}
/[^\x{100}-\x{ffff}ABC]*[\x80-\xff]/utf
\x{99}\x{99}\x{99}
0: \x{99}\x{99}\x{99}
/[^\x{100}-\x{ffff}]*[\x80-\xff]/i,utf
\x{99}\x{99}\x{99}
0: \x{99}\x{99}\x{99}
# End of testinput4 # End of testinput4