Fix anchoring in conditionals with only one branch
This commit is contained in:
parent
d568a9031a
commit
4a1f36de58
@ -0,0 +1,70 @@
|
||||
From 7abc4de8303e8908eeb96714dac53ae10ff465e3 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
||||
Date: Sun, 2 Sep 2018 17:05:38 +0000
|
||||
Subject: [PATCH] Fix anchoring bug in conditional subexpression.
|
||||
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@1739 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
||||
Petr Písař: Ported to 8.42
|
||||
---
|
||||
pcre_compile.c | 12 ++++++++++--
|
||||
testdata/testinput2 | 3 +++
|
||||
testdata/testoutput2 | 4 ++++
|
||||
|
||||
Version 8.42 20-March-2018
|
||||
--------------------------
|
||||
diff --git a/pcre_compile.c b/pcre_compile.c
|
||||
index 3991d6c..6141fb3 100644
|
||||
--- a/pcre_compile.c
|
||||
+++ b/pcre_compile.c
|
||||
@@ -8682,10 +8682,18 @@ do {
|
||||
if (!is_anchored(scode, new_map, cd, atomcount)) return FALSE;
|
||||
}
|
||||
|
||||
- /* Positive forward assertions and conditions */
|
||||
+ /* Positive forward assertion */
|
||||
|
||||
- else if (op == OP_ASSERT || op == OP_COND)
|
||||
+ else if (op == OP_ASSERT)
|
||||
+ {
|
||||
+ if (!is_anchored(scode, bracket_map, cd, atomcount)) return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ /* Condition; not anchored if no second branch */
|
||||
+
|
||||
+ else if (op == OP_COND)
|
||||
{
|
||||
+ if (scode[GET(scode,1)] != OP_ALT) return FALSE;
|
||||
if (!is_anchored(scode, bracket_map, cd, atomcount)) return FALSE;
|
||||
}
|
||||
|
||||
diff --git a/testdata/testinput2 b/testdata/testinput2
|
||||
index 8ba4dc4..3528de1 100644
|
||||
--- a/testdata/testinput2
|
||||
+++ b/testdata/testinput2
|
||||
@@ -4257,4 +4257,7 @@ backtracking verbs. --/
|
||||
ab
|
||||
aaab
|
||||
|
||||
+/(?(?=^))b/
|
||||
+ abc
|
||||
+
|
||||
/-- End of testinput2 --/
|
||||
diff --git a/testdata/testoutput2 b/testdata/testoutput2
|
||||
index 61ed8d9..4ccda27 100644
|
||||
--- a/testdata/testoutput2
|
||||
+++ b/testdata/testoutput2
|
||||
@@ -14721,4 +14721,8 @@ No need char
|
||||
0: ab
|
||||
1: a
|
||||
|
||||
+/(?(?=^))b/
|
||||
+ abc
|
||||
+ 0: b
|
||||
+
|
||||
/-- End of testinput2 --/
|
||||
--
|
||||
2.14.4
|
||||
|
@ -2,7 +2,7 @@
|
||||
#%%global rcversion RC1
|
||||
Name: pcre
|
||||
Version: 8.42
|
||||
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
|
||||
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
## Source package only:
|
||||
@ -45,6 +45,9 @@ Patch4: pcre-8.42-Fix-typos-in-pcrgrep.patch
|
||||
# 256 that is followed by a positive class with only characters less than 256,
|
||||
# upstream bug #2300, in upstream after 8.42
|
||||
Patch5: pcre-8.42-Fix-bad-auto-possessify-for-certain-classes.patch
|
||||
# Fix anchoring in conditionals with only one branch, upstream bug #2307,
|
||||
# in upstream after 8.42
|
||||
Patch6: pcre-8.42-Fix-anchoring-bug-in-conditional-subexpression.patch
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -132,6 +135,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
# Because of rpath patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -226,6 +230,9 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcretest.*
|
||||
|
||||
%changelog
|
||||
* Mon Sep 03 2018 Petr Pisar <ppisar@redhat.com> - 8.42-4
|
||||
- Fix anchoring in conditionals with only one branch (upstream bug #2307)
|
||||
|
||||
* Mon Aug 20 2018 Petr Pisar <ppisar@redhat.com> - 8.42-3
|
||||
- Fix autopossessifying a repeated negative class with no characters less than
|
||||
256 that is followed by a positive class with only characters less than 256
|
||||
|
Loading…
Reference in New Issue
Block a user