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

This commit is contained in:
Petr Písař 2018-08-20 13:10:39 +02:00
parent 972b635dbd
commit d568a9031a
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From 952cac5f4a17e52aec7d0536f405b25428367840 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri, 17 Aug 2018 14:50:21 +0000
Subject: [PATCH] Fix bad auto-possessify for certain classes.
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@1738 2f5784b3-3f2a-0410-8824-cb99058d5e15
Petr Písař: Ported to 8.42.
---
pcre_compile.c | 4 ++--
testdata/testinput4 | 3 +++
testdata/testoutput4 | 4 ++++
diff --git a/pcre_compile.c b/pcre_compile.c
index 6dd8886..3991d6c 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2016 University of Cambridge
+ Copyright (c) 1997-2018 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -3299,7 +3299,7 @@ for(;;)
if ((*xclass_flags & XCL_MAP) == 0)
{
/* No bits are set for characters < 256. */
- if (list[1] == 0) return TRUE;
+ if (list[1] == 0) return (*xclass_flags & XCL_NOT) == 0;
/* Might be an empty repeat. */
continue;
}
diff --git a/testdata/testinput4 b/testdata/testinput4
index 8bdbdac..63368c0 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -727,4 +727,7 @@
/\C(\W?ſ)'?{{/8
\\C(\\W?ſ)'?{{
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/8
+ \x{99}\x{99}\x{99}
+
/-- End of testinput4 --/
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index d43c123..69e812c 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -1277,4 +1277,8 @@ No match
\\C(\\W?ſ)'?{{
No match
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/8
+ \x{99}\x{99}\x{99}
+ 0: \x{99}\x{99}\x{99}
+
/-- End of testinput4 --/
--
2.14.4

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.42
Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}.1
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
## Source package only:
@ -41,6 +41,10 @@ Patch3: pcre-8.42-Fix-two-C-wrapper-bugs-unnoticed-for-years.patch
# Fix an error message and locale handling in pcregrep tool,
# in upstream after 8.42
Patch4: pcre-8.42-Fix-typos-in-pcrgrep.patch
# 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,
# upstream bug #2300, in upstream after 8.42
Patch5: pcre-8.42-Fix-bad-auto-possessify-for-certain-classes.patch
BuildRequires: readline-devel
BuildRequires: autoconf
BuildRequires: automake
@ -127,6 +131,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch2 -p2
%patch3 -p1
%patch4 -p1
%patch5 -p1
# Because of rpath patch
libtoolize --copy --force
autoreconf -vif
@ -221,6 +226,11 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcretest.*
%changelog
* 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
(upstream bug #2300)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.42-2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild