Revision: 1533
http://vcs.pcre.org/viewvc?view=rev&revision=1533
Author: zherczeg
Date: 2015-03-24 08:22:29 +0000 (Tue, 24 Mar 2015)
Log Message:
-----------
Fix JIT compilation of conditional blocks, which assertion is converted to (*FAIL).
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_jit_compile.c
code/trunk/pcre_jit_test.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2015-03-06 11:59:39 UTC (rev 1532)
+++ code/trunk/ChangeLog 2015-03-24 08:22:29 UTC (rev 1533)
@@ -98,7 +98,10 @@
more than one other case, caused incorrect behaviour when compiled in UTF
mode. In that example, the range a-j was left out of the class.
+26. Fix JIT compilation of conditional blocks, which assertion
+ is converted to (*FAIL). E.g: /(?(?!))/.
+
Version 8.36 26-September-2014
------------------------------
Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c 2015-03-06 11:59:39 UTC (rev 1532)
+++ code/trunk/pcre_jit_compile.c 2015-03-24 08:22:29 UTC (rev 1533)
@@ -6997,7 +6997,7 @@
has_alternatives = *cc == OP_ALT;
if (SLJIT_UNLIKELY(opcode == OP_COND || opcode == OP_SCOND))
- has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF) ? FALSE : TRUE;
+ has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF || *matchingpath == OP_FAIL) ? FALSE : TRUE;
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
opcode = OP_SCOND;
@@ -7310,6 +7310,17 @@
matchingpath = cc;
}
}
+ else if (*matchingpath == OP_FAIL)
+ {
+ SLJIT_ASSERT(!has_alternatives);
+ if (*cc == OP_ALT)
+ {
+ matchingpath = cc + 1 + LINK_SIZE;
+ cc += GET(cc, 1);
+ }
+ else
+ matchingpath = cc;
+ }
else
{
SLJIT_ASSERT(has_alternatives && *matchingpath >= OP_ASSERT && *matchingpath <= OP_ASSERTBACK_NOT);
Modified: code/trunk/pcre_jit_test.c
===================================================================
--- code/trunk/pcre_jit_test.c 2015-03-06 11:59:39 UTC (rev 1532)
+++ code/trunk/pcre_jit_test.c 2015-03-24 08:22:29 UTC (rev 1533)
@@ -631,6 +631,9 @@
{ MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+?dd", "bcabcacdb bdddd" },
{ MUA, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+l", "ababccddabdbccd abcccl" },
{ MUA, 0, "((?:a|aa)(?(1)aaa))x", "aax" },
+ { MUA, 0, "(?(?!)a|b)", "ab" },
+ { MUA, 0, "(?(?!)a)", "ab" },
+ { MUA, 0 | F_NOMATCH, "(?(?!)a|b)", "ac" },
/* Set start of match. */
{ MUA, 0, "(?:\\Ka)*aaaab", "aaaaaaaa aaaaaaabb" },