Fix register overwite in JIT when SSE2 acceleration is enabled

This commit is contained in:
Petr Písař 2016-08-30 08:07:51 +02:00
parent b1c1f8f46d
commit 9a80d95072
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From 575b84a7bcbd63f54d933804ea5036642b93c0f7 Mon Sep 17 00:00:00 2001
From: zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri, 1 Jul 2016 09:06:38 +0000
Subject: [PATCH] Fix register overwite in JIT when SSE2 acceleration is
enabled.
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@1660 2f5784b3-3f2a-0410-8824-cb99058d5e15
Petr Písař: Ported to 8.39.
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index 4f15a27..46ce6c6 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -4004,12 +4004,12 @@ sljit_emit_op_custom(compiler, instruction, 4);
if (load_twice)
{
- OP1(SLJIT_MOV, TMP3, 0, TMP2, 0);
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP2, 0);
instruction[3] = 0xc0 | (tmp2_ind << 3) | 1;
sljit_emit_op_custom(compiler, instruction, 4);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
- OP1(SLJIT_MOV, TMP2, 0, TMP3, 0);
+ OP1(SLJIT_MOV, TMP2, 0, RETURN_ADDR, 0);
}
OP2(SLJIT_ASHR, TMP1, 0, TMP1, 0, TMP2, 0);
diff --git a/pcre_jit_test.c b/pcre_jit_test.c
index 9b61ec0..034cb52 100644
--- a/pcre_jit_test.c
+++ b/pcre_jit_test.c
@@ -687,6 +687,7 @@ static struct regression_test_case regression_test_cases[] = {
{ PCRE_FIRSTLINE | PCRE_NEWLINE_LF | PCRE_DOTALL, 0 | F_NOMATCH, "ab.", "ab" },
{ MUA | PCRE_FIRSTLINE, 1 | F_NOMATCH, "^[a-d0-9]", "\nxx\nd" },
{ PCRE_NEWLINE_ANY | PCRE_FIRSTLINE | PCRE_DOTALL, 0, "....a", "012\n0a" },
+ { MUA | PCRE_FIRSTLINE, 0, "[aC]", "a" },
/* Recurse. */
{ MUA, 0, "(a)(?1)", "aa" },
--
2.5.5

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.39
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
@ -38,6 +38,9 @@ Patch1: pcre-8.32-refused_spelling_terminated.patch
# 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
# Fix register overwite in JIT when SSE2 acceleration is enabled,
# in upstream after 8.39
Patch3: pcre-8.39-Fix-register-overwite-in-JIT-when-SSE2-acceleration-.patch
BuildRequires: readline-devel
BuildRequires: autoconf
BuildRequires: automake
@ -128,6 +131,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
# Because of rpath patch
libtoolize --copy --force
autoreconf -vif
@ -224,6 +228,9 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcretest.*
%changelog
* Tue Aug 30 2016 Petr Pisar <ppisar@redhat.com> - 8.39-3
- Fix register overwite in JIT when SSE2 acceleration is enabled
* 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)