[Pcre-svn] [1738] code/trunk: Fix bad auto-possessify for ce…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1738] code/trunk: Fix bad auto-possessify for certain classes.
Revision: 1738
          http://vcs.pcre.org/viewvc?view=rev&revision=1738
Author:   ph10
Date:     2018-08-17 15:50:21 +0100 (Fri, 17 Aug 2018)
Log Message:
-----------
Fix bad auto-possessify for certain classes.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/testdata/testinput4
    code/trunk/testdata/testoutput4


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2018-08-13 09:23:38 UTC (rev 1737)
+++ code/trunk/ChangeLog    2018-08-17 14:50:21 UTC (rev 1738)
@@ -27,7 +27,12 @@


4. Typo LCC_ALL for LC_ALL fixed in pcregrep.

+5. 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 8.42 20-March-2018
--------------------------


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2018-08-13 09:23:38 UTC (rev 1737)
+++ code/trunk/pcre_compile.c    2018-08-17 14:50:21 UTC (rev 1738)
@@ -6,7 +6,7 @@
 and semantics are as close as possible to those of the Perl 5 language.


                        Written by Philip Hazel
-           Copyright (c) 1997-2016 University of Cambridge
+           Copyright (c) 1997-2018 University of Cambridge


 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -3299,7 +3299,7 @@
       if ((*xclass_flags & XCL_MAP) == 0)
         {
         /* 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. */
         continue;
         }


Modified: code/trunk/testdata/testinput4
===================================================================
--- code/trunk/testdata/testinput4    2018-08-13 09:23:38 UTC (rev 1737)
+++ code/trunk/testdata/testinput4    2018-08-17 14:50:21 UTC (rev 1738)
@@ -727,4 +727,7 @@
 /\C(\W?ſ)'?{{/8
     \\C(\\W?ſ)'?{{


+/[^\x{100}-\x{ffff}]*[\x80-\xff]/8
+    \x{99}\x{99}\x{99}
+
 /-- End of testinput4 --/


Modified: code/trunk/testdata/testoutput4
===================================================================
--- code/trunk/testdata/testoutput4    2018-08-13 09:23:38 UTC (rev 1737)
+++ code/trunk/testdata/testoutput4    2018-08-17 14:50:21 UTC (rev 1738)
@@ -1277,4 +1277,8 @@
     \\C(\\W?ſ)'?{{
 No match


+/[^\x{100}-\x{ffff}]*[\x80-\xff]/8
+    \x{99}\x{99}\x{99}
+ 0: \x{99}\x{99}\x{99}
+
 /-- End of testinput4 --/