From 21328c1699afa1ec5973ae5b0f88cd0664e1996e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 21 Feb 2017 10:24:47 +0100 Subject: [PATCH] Fix parsing comments between quantifiers --- ...of-style-comment-between-quantifier-.patch | 67 +++++++++++++++++++ pcre.spec | 9 ++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 pcre-8.40-Fix-recognition-of-style-comment-between-quantifier-.patch diff --git a/pcre-8.40-Fix-recognition-of-style-comment-between-quantifier-.patch b/pcre-8.40-Fix-recognition-of-style-comment-between-quantifier-.patch new file mode 100644 index 0000000..9424a72 --- /dev/null +++ b/pcre-8.40-Fix-recognition-of-style-comment-between-quantifier-.patch @@ -0,0 +1,67 @@ +From 63f1aabcabdc7ace28c649657fe2a4f880a87c5a Mon Sep 17 00:00:00 2001 +From: ph10 +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 + diff --git a/pcre.spec b/pcre.spec index 3eabecc..1a4830b 100644 --- a/pcre.spec +++ b/pcre.spec @@ -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 - 8.40-3 +- Fix parsing comments between quantifiers (upstream bug #2019) + * Tue Feb 14 2017 Petr Pisar - 8.40-2 - Fix pcregrep multi-line matching --only-matching option (upstream bug #1848) - Fix a crash in JIT compilation (upstream bug #2035)