Fix computing size for pattern with a negated special calss in on-UCP mode

This commit is contained in:
Petr Písař 2015-04-09 17:03:57 +02:00
parent 32c1b38f77
commit 6e32159aad
2 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,68 @@
From 0b2b017da7c68a8cddd3ee3395dcc26c87236402 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 9 Apr 2015 17:02:59 +0200
Subject: [PATCH] Fix memory bug for [\S\V\H] compile.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is upstream commit ported to 8.36:
commit ef430ada283aba3ff71d7de496904f4d137280f8
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri Mar 27 16:44:50 2015 +0000
Fix memory bug for [\S\V\H] compile.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1536 2f5784b3-3f2a-0410-8824-
cb99058d5e15
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
pcre_compile.c | 6 ++++++
testdata/testinput4 | 2 ++
testdata/testoutput4 | 2 ++
3 files changed, 10 insertions(+)
diff --git a/pcre_compile.c b/pcre_compile.c
index efc0b21..c256ea5 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -5472,6 +5472,12 @@ for (;; ptr++)
}
#endif
+ /* Even though any XCLASS list is now discarded, we must allow for
+ its memory. */
+
+ if (lengthptr != NULL)
+ *lengthptr += (int)(class_uchardata - class_uchardata_base);
+
/* If there are no characters > 255, or they are all to be included or
excluded, set the opcode to OP_CLASS or OP_NCLASS, depending on whether the
whole class was negated and whether there were negative specials such as \S
diff --git a/testdata/testinput4 b/testdata/testinput4
index 0110267..04fca1a 100644
--- a/testdata/testinput4
+++ b/testdata/testinput4
@@ -722,4 +722,6 @@
/^#[^\x{ffff}]#[^\x{ffff}]#[^\x{ffff}]#/8
#\x{10000}#\x{100}#\x{10ffff}#
+"[\S\V\H]"8
+
/-- End of testinput4 --/
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index dcf13b0..340a949 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -1271,4 +1271,6 @@ No match
#\x{10000}#\x{100}#\x{10ffff}#
0: #\x{10000}#\x{100}#\x{10ffff}#
+"[\S\V\H]"8
+
/-- End of testinput4 --/
--
2.1.0

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.36
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}5%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -22,6 +22,9 @@ Patch3: pcre-8.36-Fix-zero-repeat-assertion-condition-bug.patch
# Fix computing size of JIT read-only data, bug #1206131, upstream bug #1597,
# in upstream after 8.36
Patch4: pcre-8.36-Remove-computing-the-JIT-read-only-data-size-in-adva.patch
# Fix computing size for pattern with a negated special calss in on-UCP mode,
# bug #1210383, in upstream after 8.36
Patch5: pcre-8.36-Fix-memory-bug-for-S-V-H-compile.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@ -66,6 +69,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch2 -p1 -b .reset_groups
%patch3 -p1 -b .zero_repeat_assertion
%patch4 -p1 -b .jit_size
%patch5 -p1 -b .size_special_class
# Because of rpath patch
libtoolize --copy --force && autoreconf -vif
# One contributor's name is non-UTF-8
@ -136,6 +140,10 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcretest.*
%changelog
* Thu Apr 09 2015 Petr Pisar <ppisar@redhat.com> - 8.36-5
- Fix computing size for pattern with a negated special calss in on-UCP mode
(bug #1210383)
* Thu Mar 26 2015 Petr Pisar <ppisar@redhat.com> - 8.36-4
- Fix computing size of JIT read-only data (bug #1206131)