Fix look-behind assertion in UTF-8 JIT mode

This commit is contained in:
Petr Písař 2012-04-05 17:36:02 +02:00
parent d4eed22185
commit 949ac43e59
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 918ed08b4415c8f9a94c22588a328c712317dea9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 5 Apr 2012 17:30:16 +0200
Subject: [PATCH] Fix look-behind assertion in UTF-8 JIT mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is back-port of upstream commit for pcre-8.30:
r953 | zherczeg | 2012-03-29 19:41:57 +0200 (Čt, 29 bře 2012) | 1 line
Fixed a bug for backward assertions with REVERSE 0 in the JIT compiler
---
pcre_jit_compile.c | 3 ++-
testdata/testinput5 | 3 +++
testdata/testoutput5 | 4 ++++
3 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index 97d227c..dfb78a7 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -3417,7 +3417,8 @@ switch(type)
case OP_REVERSE:
length = GET(cc, 0);
- SLJIT_ASSERT(length > 0);
+ if (length == 0)
+ return cc + LINK_SIZE;
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
#ifdef SUPPORT_UTF
if (common->utf)
diff --git a/testdata/testinput5 b/testdata/testinput5
index 4f7cb32..de41fce 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -691,4 +691,7 @@
\x{2027}\x{2030}\x{2028}\x{2029}
\x09\x0e\x{84}\x{86}\x{85}\x0a\x0b\x0c\x0d
+/(?<!^)ETA/8
+ ETA
+
/-- End of testinput5 --/
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index 3c90ea5..693b8cd 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -1649,4 +1649,8 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
\x09\x0e\x{84}\x{86}\x{85}\x0a\x0b\x0c\x0d
0: \x{85}\x{0a}\x{0b}\x{0c}\x{0d}
+/(?<!^)ETA/8
+ ETA
+No match
+
/-- End of testinput5 --/
--
1.7.7.6

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.30
Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -13,6 +13,8 @@ Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/%{name}/%{?rcversion:Te
Patch0: pcre-8.21-multilib.patch
# Refused by upstream, bug #675477
Patch1: pcre-8.30-refused_spelling_terminated.patch
# Bug #810314, fixed in upstream after 8.30
Patch2: pcre-8.30-Fix-look-behind-assertion-in-UTF-8-JIT-mode.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@ -52,6 +54,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
# Get rid of rpath
%patch0 -p1 -b .multilib
%patch1 -p1 -b .terminated_typos
%patch2 -p1 -b .lookbehind_assertion
# Because of rpath patch
libtoolize --copy --force && autoreconf
# One contributor's name is non-UTF-8
@ -115,6 +118,9 @@ make check
%{_mandir}/man1/pcretest.*
%changelog
* Thu Apr 05 2012 Petr Pisar <ppisar@redhat.com> - 8.30-3
- Fix look-behind assertion in UTF-8 JIT mode (bug #810314)
* Tue Feb 28 2012 Petr Pisar <ppisar@redhat.com> - 8.30-2
- Remove old libpcre.so.0 from distribution
- Move library to /usr