Revision: 1308
http://vcs.pcre.org/viewvc?view=rev&revision=1308
Author: zherczeg
Date: 2013-04-02 07:58:55 +0100 (Tue, 02 Apr 2013)
Log Message:
-----------
Fix for recursions to preserve repeat counters.
Modified Paths:
--------------
code/trunk/pcre_jit_compile.c
code/trunk/pcre_jit_test.c
Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c 2013-04-01 17:13:00 UTC (rev 1307)
+++ code/trunk/pcre_jit_compile.c 2013-04-02 06:58:55 UTC (rev 1308)
@@ -1038,7 +1038,7 @@
if (private_data_ptr > SLJIT_MAX_LOCAL_SIZE)
return;
- if (*cc == OP_BRA || *cc == OP_CBRA || *cc == OP_ONCE || *cc == OP_ONCE_NC)
+ if (*cc == OP_ONCE || *cc == OP_ONCE_NC || *cc == OP_BRA || *cc == OP_CBRA || *cc == OP_COND)
if (detect_repeat(common, cc))
{
/* These brackets are converted to repeats, so no global
@@ -1496,6 +1496,12 @@
size = 0;
switch(*cc)
{
+ case OP_KET:
+ if (PRIVATE_DATA(cc) != 0)
+ private_data_length++;
+ cc += 1 + LINK_SIZE;
+ break;
+
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
@@ -1664,6 +1670,15 @@
switch(*cc)
{
+ case OP_KET:
+ if (PRIVATE_DATA(cc) != 0)
+ {
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ }
+ cc += 1 + LINK_SIZE;
+ break;
+
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
Modified: code/trunk/pcre_jit_test.c
===================================================================
--- code/trunk/pcre_jit_test.c 2013-04-01 17:13:00 UTC (rev 1307)
+++ code/trunk/pcre_jit_test.c 2013-04-02 06:58:55 UTC (rev 1308)
@@ -640,6 +640,10 @@
{ MUA, 0, "(?(R0)aa|bb(?R))", "abba aabb bbaa" },
{ MUA, 0, "((?(R)(?:aaaa|a)|(?:(aaaa)|(a)))+)(?1)$", "aaaaaaaaaa aaaa" },
{ MUA, 0, "(?P<Name>a(?(R&Name)a|b))(?1)", "aab abb abaa" },
+ { MUA, 0, "((?(R)a|(?1)){3})", "XaaaaaaaaaX" },
+ { MUA, 0, "((?:(?(R)a|(?1))){3})", "XaaaaaaaaaX" },
+ { MUA, 0, "((?(R)a|(?1)){1,3})aaaaaa", "aaaaaaaaXaaaaaaaaa" },
+ { MUA, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" },
/* 16 bit specific tests. */
{ CMA, 0 | F_FORCECONV, "\xc3\xa1", "\xc3\x81\xc3\xa1" },