pcre/pcre-8.30-Fix-look-behind-assertion-in-UTF-8-JIT-mode.patch
2012-04-05 17:38:43 +02:00

60 lines
1.7 KiB
Diff

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