Fix checking that a lookbehind assertion has a fixed length if the lookbehind assertion is used inside a lookahead assertion
This commit is contained in:
parent
9580669d91
commit
fe2ff808b5
@ -0,0 +1,133 @@
|
|||||||
|
From 8ed58f1ae9e82a5c88c3960af38d5c96b191c554 Mon Sep 17 00:00:00 2001
|
||||||
|
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||||
|
Date: Mon, 2 Jul 2018 11:23:45 +0000
|
||||||
|
Subject: [PATCH] Ignore qualifiers on lookaheads within lookbehinds when
|
||||||
|
checking for a fixed length.
|
||||||
|
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@956 6239d852-aaf2-0410-a92c-79f79f948069
|
||||||
|
Petr Písař: Ported to 10.31.
|
||||||
|
---
|
||||||
|
src/pcre2_compile.c | 26 ++++++++++++++++++++++++++
|
||||||
|
testdata/testinput1 | 10 ++++++++++
|
||||||
|
testdata/testinput2 | 2 ++
|
||||||
|
testdata/testoutput1 | 10 ++++++++++
|
||||||
|
testdata/testoutput2 | 14 ++++++++++++++
|
||||||
|
6 files changed, 66 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
|
||||||
|
index 0f75f36..5a47f1d 100644
|
||||||
|
--- a/src/pcre2_compile.c
|
||||||
|
+++ b/src/pcre2_compile.c
|
||||||
|
@@ -8572,6 +8572,32 @@ for (;; pptr++)
|
||||||
|
case META_LOOKAHEADNOT:
|
||||||
|
pptr = parsed_skip(pptr + 1, PSKIP_KET);
|
||||||
|
if (pptr == NULL) goto PARSED_SKIP_FAILED;
|
||||||
|
+
|
||||||
|
+ /* Also ignore any qualifiers that follow a lookahead assertion. */
|
||||||
|
+
|
||||||
|
+ switch (pptr[1])
|
||||||
|
+ {
|
||||||
|
+ case META_ASTERISK:
|
||||||
|
+ case META_ASTERISK_PLUS:
|
||||||
|
+ case META_ASTERISK_QUERY:
|
||||||
|
+ case META_PLUS:
|
||||||
|
+ case META_PLUS_PLUS:
|
||||||
|
+ case META_PLUS_QUERY:
|
||||||
|
+ case META_QUERY:
|
||||||
|
+ case META_QUERY_PLUS:
|
||||||
|
+ case META_QUERY_QUERY:
|
||||||
|
+ pptr++;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case META_MINMAX:
|
||||||
|
+ case META_MINMAX_PLUS:
|
||||||
|
+ case META_MINMAX_QUERY:
|
||||||
|
+ pptr += 3;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Lookbehinds can be ignored, but must themselves be checked. */
|
||||||
|
diff --git a/testdata/testinput1 b/testdata/testinput1
|
||||||
|
index fb50238..1b3191c 100644
|
||||||
|
--- a/testdata/testinput1
|
||||||
|
+++ b/testdata/testinput1
|
||||||
|
@@ -6192,4 +6192,14 @@ ef) x/x,mark
|
||||||
|
/(?<=\G.)/g,aftertext
|
||||||
|
abc
|
||||||
|
|
||||||
|
+/(?<=(?=.)?)/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.)?+)/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.)*)/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.){4,5})/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.){4,5}x)/
|
||||||
|
+
|
||||||
|
# End of testinput1
|
||||||
|
diff --git a/testdata/testinput2 b/testdata/testinput2
|
||||||
|
index 7e703d5..cc4b59b 100644
|
||||||
|
--- a/testdata/testinput2
|
||||||
|
+++ b/testdata/testinput2
|
||||||
|
@@ -5435,4 +5435,6 @@ a)"xI
|
||||||
|
|
||||||
|
/(?=a+)a(a+)++b/B
|
||||||
|
|
||||||
|
+/(?<=(?=.){4,5}x)/B
|
||||||
|
+
|
||||||
|
# End of testinput2
|
||||||
|
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
||||||
|
index 348dcbc..06469fa 100644
|
||||||
|
--- a/testdata/testoutput1
|
||||||
|
+++ b/testdata/testoutput1
|
||||||
|
@@ -9831,4 +9831,14 @@ No match
|
||||||
|
0:
|
||||||
|
0+
|
||||||
|
|
||||||
|
+/(?<=(?=.)?)/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.)?+)/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.)*)/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.){4,5})/
|
||||||
|
+
|
||||||
|
+/(?<=(?=.){4,5}x)/
|
||||||
|
+
|
||||||
|
# End of testinput1
|
||||||
|
diff --git a/testdata/testoutput2 b/testdata/testoutput2
|
||||||
|
index 9f504f6..aab0c94 100644
|
||||||
|
--- a/testdata/testoutput2
|
||||||
|
+++ b/testdata/testoutput2
|
||||||
|
@@ -16583,6 +16583,20 @@ No match
|
||||||
|
End
|
||||||
|
------------------------------------------------------------------
|
||||||
|
|
||||||
|
+/(?<=(?=.){4,5}x)/B
|
||||||
|
+------------------------------------------------------------------
|
||||||
|
+ Bra
|
||||||
|
+ AssertB
|
||||||
|
+ Reverse
|
||||||
|
+ Assert
|
||||||
|
+ Any
|
||||||
|
+ Ket
|
||||||
|
+ x
|
||||||
|
+ Ket
|
||||||
|
+ Ket
|
||||||
|
+ End
|
||||||
|
+------------------------------------------------------------------
|
||||||
|
+
|
||||||
|
# End of testinput2
|
||||||
|
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
|
||||||
|
Error -62: bad serialized data
|
||||||
|
--
|
||||||
|
2.14.4
|
||||||
|
|
11
pcre2.spec
11
pcre2.spec
@ -9,7 +9,7 @@
|
|||||||
#%%global rcversion RC1
|
#%%global rcversion RC1
|
||||||
Name: pcre2
|
Name: pcre2
|
||||||
Version: 10.31
|
Version: 10.31
|
||||||
Release: %{?rcversion:0.}6%{?rcversion:.%rcversion}%{?dist}
|
Release: %{?rcversion:0.}7%{?rcversion:.%rcversion}%{?dist}
|
||||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||||
Summary: Perl-compatible regular expression library
|
Summary: Perl-compatible regular expression library
|
||||||
# the library: BSD with exceptions
|
# the library: BSD with exceptions
|
||||||
@ -75,6 +75,10 @@ Patch8: pcre2-10.31-Fix-bug-when-K-is-used-in-a-lookbehind-in-a-substitu.pat
|
|||||||
# matches an empty string, but never at the starting offset,
|
# matches an empty string, but never at the starting offset,
|
||||||
# in upstream after 10.31
|
# in upstream after 10.31
|
||||||
Patch9: pcre2-10.31-Fix-global-search-replace-in-pcre2test-and-pcre2_sub.patch
|
Patch9: pcre2-10.31-Fix-global-search-replace-in-pcre2test-and-pcre2_sub.patch
|
||||||
|
# Fix checking that a lookbehind assertion has a fixed length if the
|
||||||
|
# lookbehind assertion is used inside a lookahead assertion,
|
||||||
|
# in upstream after 10.31
|
||||||
|
Patch10: pcre2-10.31-Ignore-qualifiers-on-lookaheads-within-lookbehinds-w.patch
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: coreutils
|
BuildRequires: coreutils
|
||||||
@ -160,6 +164,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
|
|||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
|
%patch10 -p1
|
||||||
# Because of multilib patch
|
# Because of multilib patch
|
||||||
libtoolize --copy --force
|
libtoolize --copy --force
|
||||||
autoreconf -vif
|
autoreconf -vif
|
||||||
@ -262,6 +267,10 @@ make %{?_smp_mflags} check VERBOSE=yes
|
|||||||
%{_mandir}/man1/pcre2test.*
|
%{_mandir}/man1/pcre2test.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 09 2018 Petr Pisar <ppisar@redhat.com> - 10.31-7
|
||||||
|
- Fix checking that a lookbehind assertion has a fixed length if the
|
||||||
|
lookbehind assertion is used inside a lookahead assertion
|
||||||
|
|
||||||
* Mon Jul 02 2018 Petr Pisar <ppisar@redhat.com> - 10.31-6
|
* Mon Jul 02 2018 Petr Pisar <ppisar@redhat.com> - 10.31-6
|
||||||
- Fix global search/replace in pcre2test and pcre2_substitute() when the pattern
|
- Fix global search/replace in pcre2test and pcre2_substitute() when the pattern
|
||||||
matches an empty string, but never at the starting offset
|
matches an empty string, but never at the starting offset
|
||||||
|
Loading…
Reference in New Issue
Block a user