Fix autopossessifying a repeated negative class with no characters less than 256 that is followed by a positive class with only characters less than 255

This commit is contained in:
Petr Písař 2018-08-20 12:45:10 +02:00
parent 7002d51cb1
commit 802672ef94
2 changed files with 90 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From 6f2408cec76565406fb17f2cd51e88f92d8dc0b3 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Fri, 17 Aug 2018 14:45:35 +0000
Subject: [PATCH] Fix bad auto-possessification of certain types of class.
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@986 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.32-RC1.
---
src/pcre2_auto_possess.c | 4 ++--
testdata/testinput4 | 9 +++++++++
testdata/testoutput4 | 12 ++++++++++++
diff --git a/src/pcre2_auto_possess.c b/src/pcre2_auto_possess.c
index 82a43ae..2ce152e 100644
--- a/src/pcre2_auto_possess.c
+++ b/src/pcre2_auto_possess.c
@@ -505,7 +505,7 @@ Arguments:
utf TRUE in UTF mode
cb compile data block
base_list the data list of the base opcode
- base_end the end of the data list
+ base_end the end of the base opcode
rec_limit points to recursion depth counter
Returns: TRUE if the auto-possessification is possible
@@ -730,7 +730,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 3efb1ff..a27b6af 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -2309,4 +2309,13 @@
# -------
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/utf
+ \x{99}\x{99}\x{99}
+
+/[^\x{100}-\x{ffff}ABC]*[\x80-\xff]/utf
+ \x{99}\x{99}\x{99}
+
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/i,utf
+ \x{99}\x{99}\x{99}
+
# End of testinput4
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index db474ef..ba3df37 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -3730,4 +3730,16 @@ No match
# -------
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/utf
+ \x{99}\x{99}\x{99}
+ 0: \x{99}\x{99}\x{99}
+
+/[^\x{100}-\x{ffff}ABC]*[\x80-\xff]/utf
+ \x{99}\x{99}\x{99}
+ 0: \x{99}\x{99}\x{99}
+
+/[^\x{100}-\x{ffff}]*[\x80-\xff]/i,utf
+ \x{99}\x{99}\x{99}
+ 0: \x{99}\x{99}\x{99}
+
# End of testinput4
--
2.14.4

View File

@ -9,7 +9,7 @@
%global rcversion RC1 %global rcversion RC1
Name: pcre2 Name: pcre2
Version: 10.32 Version: 10.32
Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist} Release: %{?rcversion:0.}2%{?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
@ -49,6 +49,10 @@ URL: http://www.pcre.org/
Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2 Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2
# Do no set RPATH if libdir is not /usr/lib # Do no set RPATH if libdir is not /usr/lib
Patch0: pcre2-10.10-Fix-multilib.patch Patch0: pcre2-10.10-Fix-multilib.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 255,
# upstream bug #2300, in upstream after 10.32-RC1
Patch1: pcre-10.32-RC1-Fix-bad-auto-possessification-of-certain-types-of-cl.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: coreutils BuildRequires: coreutils
@ -125,6 +129,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%prep %prep
%setup -q -n %{name}-%{myversion} %setup -q -n %{name}-%{myversion}
%patch0 -p1 %patch0 -p1
%patch1 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -227,6 +232,11 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.* %{_mandir}/man1/pcre2test.*
%changelog %changelog
* Mon Aug 20 2018 Petr Pisar <ppisar@redhat.com> - 10.32-0.2.RC1
- Fix autopossessifying a repeated negative class with no characters less than
256 that is followed by a positive class with only characters less than 255,
(upstream bug #2300)
* Thu Aug 16 2018 Petr Pisar <ppisar@redhat.com> - 10.32-0.1.RC1 * Thu Aug 16 2018 Petr Pisar <ppisar@redhat.com> - 10.32-0.1.RC1
- 10.32-RC1 bump - 10.32-RC1 bump