Fix repeated pcregrep output if -o with -M options were used and the match # extended over a line boundary

This commit is contained in:
Petr Písař 2016-06-20 09:19:18 +02:00
parent f411e60a86
commit b1c1f8f46d
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 664df44c7eb62edbce95ab6dbdedcba7f07fed02 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri, 17 Jun 2016 17:28:14 +0000
Subject: [PATCH] Fix bad interaction between -o and -M in pcregrep.
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@1658 2f5784b3-3f2a-0410-8824-cb99058d5e15
Petr Písař <ppisar@redhat.com>: Ported to 8.39.
diff --git a/pcregrep.c b/pcregrep.c
index cd53c64..fd2a676 100644
--- a/pcregrep.c
+++ b/pcregrep.c
@@ -1803,6 +1803,12 @@ while (ptr < endptr)
match = FALSE;
if (line_buffered) fflush(stdout);
rc = 0; /* Had some success */
+
+ /* If the current match ended past the end of the line (only possible
+ in multiline mode), we are done with this line. */
+
+ if ((unsigned int)offsets[1] > linelength) goto END_ONE_MATCH;
+
startoffset = offsets[1]; /* Restart after the match */
if (startoffset <= oldstartoffset)
{
--
2.5.5

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.39
Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -34,6 +34,10 @@ Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/%{name}/%{?rcversio
Patch0: pcre-8.21-multilib.patch
# Refused by upstream, bug #675477
Patch1: pcre-8.32-refused_spelling_terminated.patch
# Fix repeated pcregrep output if -o with -M options were used and the match
# extended over a line boundary, upstream bug #1848, fixed in upstream after
# 8.39
Patch2: pcre-8.39-Fix-bad-interaction-between-o-and-M-in-pcregrep.patch
BuildRequires: readline-devel
BuildRequires: autoconf
BuildRequires: automake
@ -123,6 +127,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
# Get rid of rpath
%patch0 -p1
%patch1 -p1
%patch2 -p1
# Because of rpath patch
libtoolize --copy --force
autoreconf -vif
@ -219,6 +224,10 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcretest.*
%changelog
* Mon Jun 20 2016 Petr Pisar <ppisar@redhat.com> - 8.39-2
- Fix repeated pcregrep output if -o with -M options were used and the match
extended over a line boundary (upstream bug #1848)
* Tue Jun 14 2016 Petr Pisar <ppisar@redhat.com> - 8.39-1
- 8.39 bump