Fix parsing comments between quantifiers
This commit is contained in:
parent
5e0a8b06de
commit
21328c1699
@ -0,0 +1,67 @@
|
||||
From 63f1aabcabdc7ace28c649657fe2a4f880a87c5a Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
||||
Date: Mon, 20 Feb 2017 17:45:21 +0000
|
||||
Subject: [PATCH] Fix recognition of (?# style comment between quantifier and
|
||||
'+' or '?'.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1682 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
||||
|
||||
Petr Písař: Ported to 8.40.
|
||||
|
||||
diff --git a/pcre_compile.c b/pcre_compile.c
|
||||
index de92313..c787813 100644
|
||||
--- a/pcre_compile.c
|
||||
+++ b/pcre_compile.c
|
||||
@@ -5739,6 +5739,21 @@ for (;; ptr++)
|
||||
ptr = p - 1; /* Character before the next significant one. */
|
||||
}
|
||||
|
||||
+ /* We also need to skip over (?# comments, which are not dependent on
|
||||
+ extended mode. */
|
||||
+
|
||||
+ if (ptr[1] == CHAR_LEFT_PARENTHESIS && ptr[2] == CHAR_QUESTION_MARK &&
|
||||
+ ptr[3] == CHAR_NUMBER_SIGN)
|
||||
+ {
|
||||
+ ptr += 4;
|
||||
+ while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
|
||||
+ if (*ptr == CHAR_NULL)
|
||||
+ {
|
||||
+ *errorcodeptr = ERR18;
|
||||
+ goto FAILED;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* If the next character is '+', we have a possessive quantifier. This
|
||||
implies greediness, whatever the setting of the PCRE_UNGREEDY option.
|
||||
If the next character is '?' this is a minimizing repeat, by default,
|
||||
diff --git a/testdata/testinput1 b/testdata/testinput1
|
||||
index 93abab3..5c23f41 100644
|
||||
--- a/testdata/testinput1
|
||||
+++ b/testdata/testinput1
|
||||
@@ -5739,4 +5739,7 @@ AbcdCBefgBhiBqz
|
||||
/(?=.*X)X$/
|
||||
\ X
|
||||
|
||||
+/X+(?#comment)?/
|
||||
+ >XXX<
|
||||
+
|
||||
/-- End of testinput1 --/
|
||||
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
||||
index a2b3cff..eff8ecc 100644
|
||||
--- a/testdata/testoutput1
|
||||
+++ b/testdata/testoutput1
|
||||
@@ -9442,4 +9442,8 @@ No match
|
||||
\ X
|
||||
0: X
|
||||
|
||||
+/X+(?#comment)?/
|
||||
+ >XXX<
|
||||
+ 0: X
|
||||
+
|
||||
/-- End of testinput1 --/
|
||||
--
|
||||
2.7.4
|
||||
|
@ -2,7 +2,7 @@
|
||||
#%%global rcversion RC1
|
||||
Name: pcre
|
||||
Version: 8.40
|
||||
Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
|
||||
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
Group: System Environment/Libraries
|
||||
@ -43,6 +43,9 @@ Patch3: pcre-8.40-Fix-a-missing-else-in-the-JIT-compiler-reported-by-i.patch
|
||||
# Fix a potenial buffer overflow in formatting a pcregrep error message,
|
||||
# upstream bug #2037
|
||||
Patch4: pcre-8.40-Silent-a-GCC-7-warning-about-too-small-buffer-for-pr.patch
|
||||
# Fix parsing comments between quantifiers, upstream bug #2019,
|
||||
# in upstream after 8.40
|
||||
Patch5: pcre-8.40-Fix-recognition-of-style-comment-between-quantifier-.patch
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -135,6 +138,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
# Because of rpath patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -231,6 +235,9 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcretest.*
|
||||
|
||||
%changelog
|
||||
* Tue Feb 21 2017 Petr Pisar <ppisar@redhat.com> - 8.40-3
|
||||
- Fix parsing comments between quantifiers (upstream bug #2019)
|
||||
|
||||
* Tue Feb 14 2017 Petr Pisar <ppisar@redhat.com> - 8.40-2
|
||||
- Fix pcregrep multi-line matching --only-matching option (upstream bug #1848)
|
||||
- Fix a crash in JIT compilation (upstream bug #2035)
|
||||
|
Loading…
Reference in New Issue
Block a user