[pcre-dev] [Bug 930] Using this simple regex : "(?i)ab(?-i)|…

Page principale
Supprimer ce message
Auteur: Philip Hazel
Date:  
À: pcre-dev
Sujet: [pcre-dev] [Bug 930] Using this simple regex : "(?i)ab(?-i)|c" will cause errorcode 23 in pcre_compile
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=930




--- Comment #3 from Philip Hazel <ph10@???> 2009-12-14 11:28:02 ---
On Mon, 14 Dec 2009, Rene wrote:

> sorry, I can't see the patch?...>.<


It seems to have got removed. I'll try again. Here it is:

===================================================================
--- pcre_compile.c      (revision 461)
+++ pcre_compile.c      (working copy)
@@ -5248,7 +5248,7 @@
             {
             cd->external_options = newoptions;
             }
-         else
+          else
             {
             if ((options & PCRE_IMS) != (newoptions & PCRE_IMS))
               {
@@ -5783,6 +5783,7 @@
 int length;
 int orig_bracount;
 int max_bracount;
+int old_external_options = cd->external_options;
 branch_chain bc;


 bc.outer = bcptr;
@@ -5859,6 +5860,15 @@
     return FALSE;
     }


+  /* If the external options have changed during this branch, it means that we
+  are at the top level, and a leading option setting has been encountered. We
+  need to re-set the original option values to take account of this so that,
+  during the pre-compile phase, we know to allow for a re-set at the start of
+  subsequent branches. */
+
+  if (old_external_options != cd->external_options)
+    oldims = cd->external_options & PCRE_IMS;
+
   /* Keep the highest bracket count in case (?| was used and some branch
   has fewer than the rest. */


@@ -5969,7 +5979,7 @@
     PUT(code, 1, code - start_bracket);
     code += 1 + LINK_SIZE;


-    /* Resetting option if needed */
+    /* Reset options if needed. */


     if ((options & PCRE_IMS) != oldims && *ptr == CHAR_RIGHT_PARENTHESIS)
       {



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email