Fix pcretest for expressions with a callout inside a look-behind assertion
This commit is contained in:
parent
79446f72ba
commit
a8778295bc
@ -0,0 +1,93 @@
|
||||
From 3da5528b47b88c32224cf9d14d8a4e80cd7a0815 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
||||
Date: Sat, 6 Feb 2016 16:54:14 +0000
|
||||
Subject: [PATCH] Fix pcretest bad behaviour for callout in lookbehind.
|
||||
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@1625 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
||||
|
||||
Petr Písař: Ported to 8.38.
|
||||
|
||||
diff --git a/pcretest.c b/pcretest.c
|
||||
index 488e419..63869fd 100644
|
||||
--- a/pcretest.c
|
||||
+++ b/pcretest.c
|
||||
@@ -2250,7 +2250,7 @@ data is not zero. */
|
||||
static int callout(pcre_callout_block *cb)
|
||||
{
|
||||
FILE *f = (first_callout | callout_extra)? outfile : NULL;
|
||||
-int i, pre_start, post_start, subject_length;
|
||||
+int i, current_position, pre_start, post_start, subject_length;
|
||||
|
||||
if (callout_extra)
|
||||
{
|
||||
@@ -2280,14 +2280,19 @@ printed lengths of the substrings. */
|
||||
|
||||
if (f != NULL) fprintf(f, "--->");
|
||||
|
||||
+/* If a lookbehind is involved, the current position may be earlier than the
|
||||
+match start. If so, use the match start instead. */
|
||||
+
|
||||
+current_position = (cb->current_position >= cb->start_match)?
|
||||
+ cb->current_position : cb->start_match;
|
||||
+
|
||||
PCHARS(pre_start, cb->subject, 0, cb->start_match, f);
|
||||
PCHARS(post_start, cb->subject, cb->start_match,
|
||||
- cb->current_position - cb->start_match, f);
|
||||
+ current_position - cb->start_match, f);
|
||||
|
||||
PCHARS(subject_length, cb->subject, 0, cb->subject_length, NULL);
|
||||
|
||||
-PCHARSV(cb->subject, cb->current_position,
|
||||
- cb->subject_length - cb->current_position, f);
|
||||
+PCHARSV(cb->subject, current_position, cb->subject_length - current_position, f);
|
||||
|
||||
if (f != NULL) fprintf(f, "\n");
|
||||
|
||||
@@ -5740,3 +5745,4 @@ return yield;
|
||||
}
|
||||
|
||||
/* End of pcretest.c */
|
||||
+
|
||||
diff --git a/testdata/testinput2 b/testdata/testinput2
|
||||
index 967a241..086e0f4 100644
|
||||
--- a/testdata/testinput2
|
||||
+++ b/testdata/testinput2
|
||||
@@ -4235,4 +4235,8 @@ backtracking verbs. --/
|
||||
/(?=a\K)/
|
||||
ring bpattingbobnd $ 1,oern cou \rb\L
|
||||
|
||||
+/(?<=((?C)0))/
|
||||
+ 9010
|
||||
+ abcd
|
||||
+
|
||||
/-- End of testinput2 --/
|
||||
diff --git a/testdata/testoutput2 b/testdata/testoutput2
|
||||
index 5fb28d5..d414a72 100644
|
||||
--- a/testdata/testoutput2
|
||||
+++ b/testdata/testoutput2
|
||||
@@ -14650,4 +14650,19 @@ Start of matched string is beyond its end - displaying from end to start.
|
||||
0: a
|
||||
0L
|
||||
|
||||
+/(?<=((?C)0))/
|
||||
+ 9010
|
||||
+--->9010
|
||||
+ 0 ^ 0
|
||||
+ 0 ^ 0
|
||||
+ 0:
|
||||
+ 1: 0
|
||||
+ abcd
|
||||
+--->abcd
|
||||
+ 0 ^ 0
|
||||
+ 0 ^ 0
|
||||
+ 0 ^ 0
|
||||
+ 0 ^ 0
|
||||
+No match
|
||||
+
|
||||
/-- End of testinput2 --/
|
||||
--
|
||||
2.5.0
|
||||
|
10
pcre.spec
10
pcre.spec
@ -2,7 +2,7 @@
|
||||
#%%global rcversion RC1
|
||||
Name: pcre
|
||||
Version: 8.38
|
||||
Release: %{?rcversion:0.}6%{?rcversion:.%rcversion}%{?dist}.1
|
||||
Release: %{?rcversion:0.}7%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
Group: System Environment/Libraries
|
||||
@ -67,6 +67,9 @@ Patch10: pcre-8.38-Fix-by-hacking-another-length-computation-issue.patch
|
||||
# of the match to be earlier than the end, upstream bug #1744,
|
||||
# fixed in upstream after 8.38
|
||||
Patch11: pcre-8.38-Fix-get_substring_list-bug-when-K-is-used-in-an-asse.patch
|
||||
# Fix pcretest for expressions with a callout inside a look-behind assertion,
|
||||
# upstream bug #1783, fixed in upstream after 8.38
|
||||
Patch12: pcre-8.38-Fix-pcretest-bad-behaviour-for-callout-in-lookbehind.patch
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -127,6 +130,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
# Because of rpath patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -198,6 +202,10 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcretest.*
|
||||
|
||||
%changelog
|
||||
* Thu Feb 11 2016 Petr Pisar <ppisar@redhat.com> - 8.38-7
|
||||
- Fix pcretest for expressions with a callout inside a look-behind assertion
|
||||
(upstream bug #1783)
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 8.38-6.1
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user