From 8106d529ae26353fa807c8c19e70eadabdf37a08 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Nov 01 2018 11:28:28 +0000 Subject: Fix matching a zero-repeated subroutine call at a start of a pattern --- diff --git a/pcre-8.42-Fix-zero-repeat-leading-subroutine-call-first-charac.patch b/pcre-8.42-Fix-zero-repeat-leading-subroutine-call-first-charac.patch new file mode 100644 index 0000000..c997a5b --- /dev/null +++ b/pcre-8.42-Fix-zero-repeat-leading-subroutine-call-first-charac.patch @@ -0,0 +1,89 @@ +From a65e1b693110caa27fe8f724583fc28ce5924026 Mon Sep 17 00:00:00 2001 +From: ph10 +Date: Sat, 20 Oct 2018 09:38:44 +0000 +Subject: [PATCH] Fix zero-repeat leading subroutine call first character + error. +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@1741 2f5784b3-3f2a-0410-8824-cb99058d5e15 +Petr Písař: Ported to 8.42. +--- + pcre_compile.c | 2 ++ + testdata/testinput1 | 15 +++++++++++++++ + testdata/testoutput1 | 24 ++++++++++++++++++++++++ + +diff --git a/pcre_compile.c b/pcre_compile.c +index 6141fb3..079d30a 100644 +--- a/pcre_compile.c ++++ b/pcre_compile.c +@@ -7642,6 +7642,8 @@ for (;; ptr++) + /* Can't determine a first byte now */ + + if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE; ++ zerofirstchar = firstchar; ++ zerofirstcharflags = firstcharflags; + continue; + + +diff --git a/testdata/testinput1 b/testdata/testinput1 +index 5c23f41..02e4f48 100644 +--- a/testdata/testinput1 ++++ b/testdata/testinput1 +@@ -5742,4 +5742,19 @@ AbcdCBefgBhiBqz + /X+(?#comment)?/ + >XXX< + ++/ (? \w+ )* \. /xi ++ pokus. ++ ++/(?(DEFINE) (? \w+ ) ) (?&word)* \./xi ++ pokus. ++ ++/(?(DEFINE) (? \w+ ) ) ( (?&word)* ) \./xi ++ pokus. ++ ++/(?&word)* (?(DEFINE) (? \w+ ) ) \./xi ++ pokus. ++ ++/(?&word)* \. (? \w+ )/xi ++ pokus.hokus ++ + /-- End of testinput1 --/ +diff --git a/testdata/testoutput1 b/testdata/testoutput1 +index eff8ecc..e6147e6 100644 +--- a/testdata/testoutput1 ++++ b/testdata/testoutput1 +@@ -9446,4 +9446,28 @@ No match + >XXX< + 0: X + ++/ (? \w+ )* \. /xi ++ pokus. ++ 0: pokus. ++ 1: pokus ++ ++/(?(DEFINE) (? \w+ ) ) (?&word)* \./xi ++ pokus. ++ 0: pokus. ++ ++/(?(DEFINE) (? \w+ ) ) ( (?&word)* ) \./xi ++ pokus. ++ 0: pokus. ++ 1: ++ 2: pokus ++ ++/(?&word)* (?(DEFINE) (? \w+ ) ) \./xi ++ pokus. ++ 0: pokus. ++ ++/(?&word)* \. (? \w+ )/xi ++ pokus.hokus ++ 0: pokus.hokus ++ 1: hokus ++ + /-- End of testinput1 --/ +-- +2.17.2 + diff --git a/pcre.spec b/pcre.spec index 167f7de..9a11fe1 100644 --- a/pcre.spec +++ b/pcre.spec @@ -51,6 +51,9 @@ Patch6: pcre-8.42-Fix-anchoring-bug-in-conditional-subexpression.patch # Fix a subject buffer overread in JIT when UTF is disabled and \X or \R has # a greater than 1 fixed quantifier, in upstream after 8.42 Patch7: pcre-8.42-Fix-subject-buffer-overread-in-JIT.patch +# Fix matching a zero-repeated subroutine call at a start of a pattern, +# upstream bug #2332, in upstream after 8.42 +Patch8: pcre-8.42-Fix-zero-repeat-leading-subroutine-call-first-charac.patch BuildRequires: readline-devel BuildRequires: autoconf BuildRequires: automake @@ -140,6 +143,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest. %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 # Because of rpath patch libtoolize --copy --force autoreconf -vif @@ -237,6 +241,8 @@ make %{?_smp_mflags} check VERBOSE=yes * Thu Nov 01 2018 Petr Pisar - 8.42-5 - Fix a subject buffer overread in JIT when UTF is disabled and \X or \R has a greater than 1 fixed quantifier +- Fix matching a zero-repeated subroutine call at a start of a pattern + (upstream bug #2332) * Mon Sep 03 2018 Petr Pisar - 8.42-4 - Fix anchoring in conditionals with only one branch (upstream bug #2307)