Fix compilation of a parenthesized comment
This commit is contained in:
parent
07d112eaa6
commit
040745a6d2
@ -0,0 +1,125 @@
|
||||
From 9b7e52d469c3c0016efb9e0a74895b187215cecb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@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@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@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
|
||||
|
@ -28,6 +28,9 @@ Patch5: 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
|
||||
Patch6: 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
|
||||
Patch7: 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
|
||||
@ -74,6 +77,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
|
||||
%patch4 -p1 -b .jit_size
|
||||
%patch5 -p1 -b .size_special_class
|
||||
%patch6 -p1 -b .mutual_recursion
|
||||
%patch7 -p1 -b .parenthesized_comment
|
||||
# Because of rpath patch
|
||||
libtoolize --copy --force && autoreconf -vif
|
||||
# One contributor's name is non-UTF-8
|
||||
@ -149,6 +153,7 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
(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 Mar 26 2015 Petr Pisar <ppisar@redhat.com> - 8.36-4
|
||||
- Fix computing size of JIT read-only data (bug #1206131)
|
||||
|
Loading…
Reference in New Issue
Block a user