[Pcre-svn] [1613] code/trunk: Fix bug for isolated \E betwee…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1613] code/trunk: Fix bug for isolated \E between an item and its qualifier when auto callout is
Revision: 1613
          http://vcs.pcre.org/viewvc?view=rev&revision=1613
Author:   ph10
Date:     2015-11-27 17:41:04 +0000 (Fri, 27 Nov 2015)
Log Message:
-----------
Fix bug for isolated \E between an item and its qualifier when auto callout is 
set.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-11-27 17:13:13 UTC (rev 1612)
+++ code/trunk/ChangeLog    2015-11-27 17:41:04 UTC (rev 1613)
@@ -11,7 +11,11 @@
     an item and its qualifier (for example, A(?#comment)?B) pcre_compile() 
     misbehaved. This bug was found by the LLVM fuzzer.


-2.  Further to 8.38/46, negated classes such as [^[:^ascii:]\d] were also not 
+2.  Similar to the above, if an isolated \E was present between an item and its
+    qualifier when PCRE_AUTO_CALLOUT was set, pcre_compile() misbehaved. This
+    bug was found by the LLVM fuzzer.
+
+3.  Further to 8.38/46, negated classes such as [^[:^ascii:]\d] were also not 
     working correctly in UCP mode.




Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2015-11-27 17:13:13 UTC (rev 1612)
+++ code/trunk/pcre_compile.c    2015-11-27 17:41:04 UTC (rev 1613)
@@ -4645,9 +4645,10 @@
     goto FAILED;
     }


- /* If in \Q...\E, check for the end; if not, we have a literal */
+ /* If in \Q...\E, check for the end; if not, we have a literal. Otherwise an
+ isolated \E is ignored. */

-  if (inescq && c != CHAR_NULL)
+  if (c != CHAR_NULL)
     {
     if (c == CHAR_BACKSLASH && ptr[1] == CHAR_E)
       {
@@ -4655,7 +4656,7 @@
       ptr++;
       continue;
       }
-    else
+    else if (inescq)
       {
       if (previous_callout != NULL)
         {
@@ -4670,7 +4671,6 @@
         }
       goto NORMAL_CHAR;
       }
-    /* Control does not reach here. */
     }


/* In extended mode, skip white space and comments. We need a loop in order

Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2015-11-27 17:13:13 UTC (rev 1612)
+++ code/trunk/testdata/testinput2    2015-11-27 17:41:04 UTC (rev 1613)
@@ -4225,4 +4225,6 @@


/L(?#(|++<!(2)?/BCOZ

+/(A*)\E+/CBZ
+
/-- End of testinput2 --/

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-11-27 17:13:13 UTC (rev 1612)
+++ code/trunk/testdata/testoutput2    2015-11-27 17:41:04 UTC (rev 1613)
@@ -14610,4 +14610,18 @@
         End
 ------------------------------------------------------------------


+/(A*)\E+/CBZ
+------------------------------------------------------------------
+        Bra
+        Callout 255 0 7
+        SCBra 1
+        Callout 255 1 2
+        A*
+        Callout 255 3 0
+        KetRmax
+        Callout 255 7 0
+        Ket
+        End
+------------------------------------------------------------------
+
 /-- End of testinput2 --/