From d9a37e0df77098dda87247de3aece6d66e94331b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 27 Jul 2017 07:58:52 +0200 Subject: [PATCH] Fix applying local x modifier while global xx was in effect --- ....30-RC1-Fix-bug-in-xx-implementation.patch | 104 ++++++++++++++++++ pcre2.spec | 9 +- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 pcre2-10.30-RC1-Fix-bug-in-xx-implementation.patch diff --git a/pcre2-10.30-RC1-Fix-bug-in-xx-implementation.patch b/pcre2-10.30-RC1-Fix-bug-in-xx-implementation.patch new file mode 100644 index 0000000..1ac8ef1 --- /dev/null +++ b/pcre2-10.30-RC1-Fix-bug-in-xx-implementation.patch @@ -0,0 +1,104 @@ +From 7511f7fe27af8e5a8e56be790b5bdb9a56475f12 Mon Sep 17 00:00:00 2001 +From: ph10 +Date: Tue, 25 Jul 2017 15:27:30 +0000 +Subject: [PATCH] Fix bug in /xx implementation. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@848 6239d852-aaf2-0410-a92c-79f79f948069 +Signed-off-by: Petr Písař +--- + src/pcre2_compile.c | 19 ++++++++++++++----- + testdata/testinput1 | 12 ++++++++++++ + testdata/testoutput1 | 16 ++++++++++++++++ + 3 files changed, 42 insertions(+), 5 deletions(-) + +diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c +index c4aa14e..8368b39 100644 +--- a/src/pcre2_compile.c ++++ b/src/pcre2_compile.c +@@ -3535,8 +3535,12 @@ while (ptr < ptrend) + /* If x appears twice it sets the extended extended option. */ + + case CHAR_x: +- *optset |= ((*optset & PCRE2_EXTENDED) != 0)? +- PCRE2_EXTENDED_MORE : PCRE2_EXTENDED; ++ *optset |= PCRE2_EXTENDED; ++ if (ptr < ptrend && *ptr == CHAR_x) ++ { ++ *optset |= PCRE2_EXTENDED_MORE; ++ ptr++; ++ } + break; + + default: +@@ -3545,11 +3549,16 @@ while (ptr < ptrend) + goto FAILED; + } + } +- options = (options | set) & (~unset); + +- /* Unsetting extended should also get rid of extended-more. */ ++ /* If we are setting extended without extended-more, ensure that any ++ existing extended-more gets unset. Also, unsetting extended must also ++ unset extended-more. */ + +- if ((options & PCRE2_EXTENDED) == 0) options &= ~PCRE2_EXTENDED_MORE; ++ if ((set & (PCRE2_EXTENDED|PCRE2_EXTENDED_MORE)) == PCRE2_EXTENDED || ++ (unset & PCRE2_EXTENDED) != 0) ++ unset |= PCRE2_EXTENDED_MORE; ++ ++ options = (options | set) & (~unset); + + /* If the options ended with ')' this is not the start of a nested + group with option changes, so the options change at this level. +diff --git a/testdata/testinput1 b/testdata/testinput1 +index 8c76e21..24de5b0 100644 +--- a/testdata/testinput1 ++++ b/testdata/testinput1 +@@ -6146,4 +6146,16 @@ ef) x/x,mark + + # -------------------------------------------------------------------------- + ++/<(?x:[a b])>/xx ++ < > ++ ++/<(?:[a b])>/xx ++ < > ++ ++/<(?xxx:[a b])>/ ++ < > ++ ++/<(?-x:[a b])>/xx ++ < > ++ + # End of testinput1 +diff --git a/testdata/testoutput1 b/testdata/testoutput1 +index 85c1aad..ca955f2 100644 +--- a/testdata/testoutput1 ++++ b/testdata/testoutput1 +@@ -9739,4 +9739,20 @@ No match + + # -------------------------------------------------------------------------- + ++/<(?x:[a b])>/xx ++ < > ++ 0: < > ++ ++/<(?:[a b])>/xx ++ < > ++No match ++ ++/<(?xxx:[a b])>/ ++ < > ++No match ++ ++/<(?-x:[a b])>/xx ++ < > ++ 0: < > ++ + # End of testinput1 +-- +2.9.4 + diff --git a/pcre2.spec b/pcre2.spec index 362da8d..66d1de2 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -2,7 +2,7 @@ %global rcversion RC1 Name: pcre2 Version: 10.30 -Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}.1 +Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -49,6 +49,9 @@ Patch2: pcre2-10.30-RC1-Put-back-pcre2_set_recursion_limit-as-a-real-functio Patch3: pcre2-10.30-RC1-Fix-formatting-converted_length.patch # Fix a compiler warning in JIT code for ppc32, in upstream after 10.30-RC1 Patch4: pcre2-10.30-RC1-JIT-compiler-update.patch +# Fix applying local x modifier while global xx was in effect, +# in upstream after 10.30-RC1 +Patch5: pcre2-10.30-RC1-Fix-bug-in-xx-implementation.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -128,6 +131,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 # Because of multilib patch libtoolize --copy --force autoreconf -vif @@ -227,6 +231,9 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Thu Jul 27 2017 Petr Pisar - 10.30-0.3.RC1 +- Fix applying local x modifier while global xx was in effect + * Thu Jul 27 2017 Fedora Release Engineering - 10.30-0.2.RC1.1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild