summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-08-26 13:44:24 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-08-26 13:44:24 +0000
commit5e2103fd4379cf7924a055486319b817a27ff8fe (patch)
treed5850f69d10d19876818aa1812a4be07de79e9f0
parent3d03682cb04729fe44211dc04d01d5075d7437c1 (diff)
downloadpcre-5e2103fd4379cf7924a055486319b817a27ff8fe.tar.gz
Fixed a corner case of range optimization in JIT.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1596 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog2
-rw-r--r--pcre_jit_compile.c2
-rw-r--r--pcre_jit_test.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 68e4df0..a721278 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -143,6 +143,8 @@ Version 8.38 xx-xxx-xxxx
37. Fix two assertion fails in JIT. These issues were found by Karl Skomski
with a custom LLVM fuzzer.
+38. Fixed a corner case of range optimization in JIT.
+
Version 8.37 28-April-2015
--------------------------
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index 9301394..aa1b6cb 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -4342,8 +4342,10 @@ switch(length)
case 4:
if ((ranges[1] - ranges[0]) == (ranges[3] - ranges[2])
&& (ranges[0] | (ranges[2] - ranges[0])) == ranges[2]
+ && (ranges[1] & (ranges[2] - ranges[0])) == 0
&& is_powerof2(ranges[2] - ranges[0]))
{
+ SLJIT_ASSERT((ranges[0] & (ranges[2] - ranges[0])) == 0 && (ranges[2] & ranges[3] & (ranges[2] - ranges[0])) != 0);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[2] - ranges[0]);
if (ranges[2] + 1 != ranges[3])
{
diff --git a/pcre_jit_test.c b/pcre_jit_test.c
index d03993b..1737895 100644
--- a/pcre_jit_test.c
+++ b/pcre_jit_test.c
@@ -182,6 +182,7 @@ static struct regression_test_case regression_test_cases[] = {
{ CMUAP, 0, "\xf0\x90\x90\x80{2}", "\xf0\x90\x90\x80#\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
{ CMUAP, 0, "\xf0\x90\x90\xa8{2}", "\xf0\x90\x90\x80#\xf0\x90\x90\xa8\xf0\x90\x90\x80" },
{ CMUAP, 0, "\xe1\xbd\xb8\xe1\xbf\xb8", "\xe1\xbf\xb8\xe1\xbd\xb8" },
+ { MA, 0, "[3-57-9]", "5" },
/* Assertions. */
{ MUA, 0, "\\b[^A]", "A_B#" },