ppisar pushed to pcre (f21). "Fix compilation of a parenthesized comment"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri Apr 10 08:06:22 UTC 2015


>From 595fea4314afe849219e76f638a9be74da089279 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Thu, 9 Apr 2015 17:51:48 +0200
Subject: Fix compilation of a parenthesized comment


diff --git a/pcre-8.36-Fix-comment-between-subroutine-call-and-quantifier-b.patch b/pcre-8.36-Fix-comment-between-subroutine-call-and-quantifier-b.patch
new file mode 100644
index 0000000..1d68501
--- /dev/null
+++ b/pcre-8.36-Fix-comment-between-subroutine-call-and-quantifier-b.patch
@@ -0,0 +1,125 @@
+From 9b7e52d469c3c0016efb9e0a74895b187215cecb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 9 Apr 2015 17:50:59 +0200
+Subject: [PATCH] Fix comment between subroutine call and quantifier bug.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream commit ported to 8.36:
+
+commit 0bff93ec6f942ad9703a33416c3ca2ddc060de73
+Author: ph10 <ph10 at 2f5784b3-3f2a-0410-8824-cb99058d5e15>
+Date:   Sun Mar 29 11:22:24 2015 +0000
+
+    Fix comment between subroutine call and quantifier bug.
+
+    git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1538 2f5784b3-3f2a-0410-8824-
+cb99058d5e15
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+
+diff --git a/pcre_compile.c b/pcre_compile.c
+index ce187cd..603e50a 100644
+--- a/pcre_compile.c
++++ b/pcre_compile.c
+@@ -6426,15 +6426,25 @@ for (;; ptr++)
+     parenthesis forms.  */
+ 
+     case CHAR_LEFT_PARENTHESIS:
+-    newoptions = options;
+-    skipbytes = 0;
+-    bravalue = OP_CBRA;
+-    save_hwm = cd->hwm;
+-    reset_bracount = FALSE;
++    ptr++;
+ 
+-    /* First deal with various "verbs" that can be introduced by '*'. */
++    /* First deal with comments. Putting this code right at the start ensures
++    that comments have no bad side effects. */
++                                                                            
++    if (ptr[0] == CHAR_QUESTION_MARK && ptr[1] == CHAR_NUMBER_SIGN)       
++      {                                                       
++      ptr += 2;                
++      while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
++      if (*ptr == CHAR_NULL)                                     
++        {                                                                 
++        *errorcodeptr = ERR18;                                          
++        goto FAILED;                                               
++        }                                                           
++      continue;                                                         
++      }                        
++
++    /* Now deal with various "verbs" that can be introduced by '*'. */
+ 
+-    ptr++;
+     if (ptr[0] == CHAR_ASTERISK && (ptr[1] == ':'
+          || (MAX_255(ptr[1]) && ((cd->ctypes[ptr[1]] & ctype_letter) != 0))))
+       {
+@@ -6555,10 +6565,18 @@ for (;; ptr++)
+       goto FAILED;
+       }
+ 
++    /* Initialize for "real" parentheses */
++
++    newoptions = options;
++    skipbytes = 0;
++    bravalue = OP_CBRA;
++    save_hwm = cd->hwm;
++    reset_bracount = FALSE;
++
+     /* Deal with the extended parentheses; all are introduced by '?', and the
+     appearance of any of them means that this is not a capturing group. */
+ 
+-    else if (*ptr == CHAR_QUESTION_MARK)
++    if (*ptr == CHAR_QUESTION_MARK)
+       {
+       int i, set, unset, namelen;
+       int *optset;
+@@ -6567,17 +6585,6 @@ for (;; ptr++)
+ 
+       switch (*(++ptr))
+         {
+-        case CHAR_NUMBER_SIGN:                 /* Comment; skip to ket */
+-        ptr++;
+-        while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+-        if (*ptr == CHAR_NULL)
+-          {
+-          *errorcodeptr = ERR18;
+-          goto FAILED;
+-          }
+-        continue;
+-
+-
+         /* ------------------------------------------------------------ */
+         case CHAR_VERTICAL_LINE:  /* Reset capture count for each branch */
+         reset_bracount = TRUE;
+diff --git a/testdata/testinput1 b/testdata/testinput1
+index 091e307..29f9d2d 100644
+--- a/testdata/testinput1
++++ b/testdata/testinput1
+@@ -5723,4 +5723,7 @@ AbcdCBefgBhiBqz
+ /(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
+     1234abcd
+ 
++"(?1)(?#?'){8}(a)"
++    baaaaaaaaac
++
+ /-- End of testinput1 --/
+diff --git a/testdata/testoutput1 b/testdata/testoutput1
+index ba7ca37..34d1b55 100644
+--- a/testdata/testoutput1
++++ b/testdata/testoutput1
+@@ -9420,4 +9420,9 @@ No match
+  4: <unset>
+  5: 
+ 
++"(?1)(?#?'){8}(a)"
++    baaaaaaaaac
++ 0: aaaaaaaaa
++ 1: a
++
+ /-- End of testinput1 --/
+-- 
+2.1.0
+
diff --git a/pcre.spec b/pcre.spec
index 8278f48..f1e7b99 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -50,6 +50,9 @@ Patch12: pcre-8.36-Fix-memory-bug-for-S-V-H-compile.patch
 # Fix compilation of a pattern with mutual recursion nested inside other group,
 # bug #1210393, in upstream after 8.36
 Patch13: pcre-8.36-Fix-mutual-recursion-inside-other-groups-stack-overf.patch
+# Fix compilation of a parenthesized comment, bug #1210410,
+# in upstream after 8.36
+Patch14: pcre-8.36-Fix-comment-between-subroutine-call-and-quantifier-b.patch
 BuildRequires: readline-devel
 # New libtool to get rid of rpath
 BuildRequires: autoconf, automake, libtool
@@ -103,6 +106,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
 %patch11 -p1 -b .zero_repeat_assertion
 %patch12 -p1 -b .size_special_class
 %patch13 -p1 -b .mutual_recursion
+%patch14 -p1 -b .parenthesized_comment
 # Because of rpath patch
 libtoolize --copy --force && autoreconf -vif
 # One contributor's name is non-UTF-8
@@ -178,6 +182,7 @@ make %{?_smp_mflags} check
   (bug #1210383)
 - Fix compilation of a pattern with mutual recursion nested inside other group
   (bug #1210393)
+- Fix compilation of a parenthesized comment (bug #1210410)
 
 * Thu Nov 20 2014 Petr Pisar <ppisar at redhat.com> - 8.35-8
 - Fix CVE-2014-8964 (unused memory usage on zero-repeat assertion condition)
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/pcre.git/commit/?h=f21&id=595fea4314afe849219e76f638a9be74da089279


More information about the scm-commits mailing list