summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2013-04-02 06:58:55 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2013-04-02 06:58:55 +0000
commit4ecaf0e27e8a2174744c464b97893e0754df9482 (patch)
treee93c5b1f31ba65f6cb4b495f1469fb9114c103d6
parentf6722fecc153ca9196b3f8bce76a002dc80f1437 (diff)
downloadpcre-4ecaf0e27e8a2174744c464b97893e0754df9482.tar.gz
Fix for recursions to preserve repeat counters.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1308 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--pcre_jit_compile.c17
-rw-r--r--pcre_jit_test.c4
2 files changed, 20 insertions, 1 deletions
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index 5343e18..79ad0e0 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -1038,7 +1038,7 @@ while (cc < ccend)
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 @@ while (cc < ccend)
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 @@ do
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:
diff --git a/pcre_jit_test.c b/pcre_jit_test.c
index c8daffb..1c247c5 100644
--- a/pcre_jit_test.c
+++ b/pcre_jit_test.c
@@ -640,6 +640,10 @@ static struct regression_test_case regression_test_cases[] = {
{ 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" },