[Pcre-svn] [617] code/trunk: Fix caseless minimizing back re…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [617] code/trunk: Fix caseless minimizing back reference bug when heap in use for recursion.
Revision: 617
          http://www.exim.org/viewvc/pcre2?view=rev&revision=617
Author:   ph10
Date:     2016-12-10 14:59:24 +0000 (Sat, 10 Dec 2016)
Log Message:
-----------
Fix caseless minimizing back reference bug when heap in use for recursion.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_match.c
    code/trunk/testdata/testinput1
    code/trunk/testdata/testoutput1


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-12-09 18:19:38 UTC (rev 616)
+++ code/trunk/ChangeLog    2016-12-10 14:59:24 UTC (rev 617)
@@ -211,7 +211,14 @@
 33. If the starting offset was specified as greater than the subject length in 
 a call to pcre2_substitute() an out-of-bounds memory reference could occur.


+34. When PCRE2 was compiled to use the heap instead of the stack for recursive
+calls to match(), a repeated minimizing caseless back reference, or a
+maximizing one where the two cases had different numbers of code units,
+followed by a caseful back reference, could lose the caselessness of the first
+repeated back reference (example: /(Z)(a)\2{1,2}?(?-i)\1X/i should match ZaAAZX
+but didn't).

+
Version 10.22 29-July-2016
--------------------------


Modified: code/trunk/src/pcre2_match.c
===================================================================
--- code/trunk/src/pcre2_match.c    2016-12-09 18:19:38 UTC (rev 616)
+++ code/trunk/src/pcre2_match.c    2016-12-10 14:59:24 UTC (rev 617)
@@ -586,7 +586,6 @@
 BOOL utf;         /* Local copy of UTF flag for speed */


BOOL minimize, possessive; /* Quantifier options */
-BOOL caseless;
int condcode;

/* When recursion is not being used, all "local" variables that have to be
@@ -724,6 +723,7 @@
the alternative names that are used. */

 #define allow_zero      cur_is_word
+#define caseless        cur_is_word
 #define cbegroup        condition
 #define code_offset     codelink
 #define condassert      condition


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2016-12-09 18:19:38 UTC (rev 616)
+++ code/trunk/testdata/testinput1    2016-12-10 14:59:24 UTC (rev 617)
@@ -5815,4 +5815,7 @@
 /(?s)(?=.*?)b/
     aabc


+/(Z)(a)\2{1,2}?(?-i)\1X/i
+    ZaAAZX
+
 # End of testinput1 


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2016-12-09 18:19:38 UTC (rev 616)
+++ code/trunk/testdata/testoutput1    2016-12-10 14:59:24 UTC (rev 617)
@@ -9289,4 +9289,10 @@
     aabc
  0: b


+/(Z)(a)\2{1,2}?(?-i)\1X/i
+    ZaAAZX
+ 0: ZaAAZX
+ 1: Z
+ 2: a
+
 # End of testinput1