diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2013-04-01 14:50:45 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2013-04-01 14:50:45 +0000 |
commit | 2124c9651464dc3c97b9d1cb9a13fe57bca181e4 (patch) | |
tree | 19ef7375870f35bc9092a833b76258d8aabf2771 | |
parent | f3bbcd7f3b62b8ab58afcec27222772e2bb56197 (diff) | |
download | pcre-2124c9651464dc3c97b9d1cb9a13fe57bca181e4.tar.gz |
Fix open parens in MAKE/SKIP/PRUNE/THEN name bug.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1305 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | pcre_compile.c | 15 | ||||
-rw-r--r-- | testdata/testinput1 | 12 | ||||
-rw-r--r-- | testdata/testoutput1 | 19 |
4 files changed, 39 insertions, 10 deletions
@@ -127,6 +127,9 @@ Version 8.33 xx-xxxx-201x 32. Control verbs are handled in the same way in JIT and interpreter. +33. An opening parenthesis in a MARK/PRUNE/SKIP/THEN name in a pattern that + contained a forward subroutine reference caused a compile error. + Version 8.32 30-November-2012 ----------------------------- diff --git a/pcre_compile.c b/pcre_compile.c index 4f17ba1..110df2a 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -1409,7 +1409,11 @@ if (ptr[0] == CHAR_LEFT_PARENTHESIS) { /* Handle specials such as (*SKIP) or (*UTF8) etc. */ - if (ptr[1] == CHAR_ASTERISK) ptr += 2; + if (ptr[1] == CHAR_ASTERISK) + { + ptr += 2; + while (ptr < cd->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++; + } /* Handle a normal, unnamed capturing parenthesis. */ @@ -2130,9 +2134,6 @@ for (;;) case OP_MARK: case OP_PRUNE_ARG: case OP_SKIP_ARG: - code += code[1]; - break; - case OP_THEN_ARG: code += code[1]; break; @@ -2250,9 +2251,6 @@ for (;;) case OP_MARK: case OP_PRUNE_ARG: case OP_SKIP_ARG: - code += code[1]; - break; - case OP_THEN_ARG: code += code[1]; break; @@ -2617,9 +2615,6 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE); case OP_MARK: case OP_PRUNE_ARG: case OP_SKIP_ARG: - code += code[1]; - break; - case OP_THEN_ARG: code += code[1]; break; diff --git a/testdata/testinput1 b/testdata/testinput1 index 232a45e..6319a25 100644 --- a/testdata/testinput1 +++ b/testdata/testinput1 @@ -5576,4 +5576,16 @@ AbcdCBefgBhiBqz /^(A(*THEN)B|C(*THEN)D)/ CD +/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + +/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + +/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + +/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + /-- End of testinput1 --/ diff --git a/testdata/testoutput1 b/testdata/testoutput1 index 39e9e59..c07816b 100644 --- a/testdata/testoutput1 +++ b/testdata/testoutput1 @@ -9153,4 +9153,23 @@ No match 0: CD 1: CD +/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + 0: b +MK: m(m + +/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + 0: b +MK: m(m + +/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + 0: b + +/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K + abc + 0: b +MK: m(m + /-- End of testinput1 --/ |