diff --git a/ChangeLog b/ChangeLog index e8809c8..966fb19 100644 --- a/ChangeLog +++ b/ChangeLog @@ -266,6 +266,8 @@ dynamically to avoid the possibility of integer overflow. 77. Implement pcre2_set_max_pattern_length() so that programs can restrict the size of patterns that they are prepared to handle. +78. (*NO_AUTO_POSSESS) was not working. + Version 10.20 30-June-2015 -------------------------- diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 8b6ac6c..c6e78e2 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -8599,7 +8599,7 @@ compiler gives a warning about loss of "const" attribute if the cast if (errorcode == 0) { if (re->top_backref > re->top_bracket) errorcode = ERR15; - else if ((options & PCRE2_NO_AUTO_POSSESS) == 0) + else if ((re->overall_options & PCRE2_NO_AUTO_POSSESS) == 0) { PCRE2_UCHAR *temp = (PCRE2_UCHAR *)codestart; if (PRIV(auto_possessify)(temp, utf, &cb) != 0) errorcode = ERR80; diff --git a/testdata/testinput15 b/testdata/testinput15 index 7d72ce6..4ea9ffd 100644 --- a/testdata/testinput15 +++ b/testdata/testinput15 @@ -151,5 +151,13 @@ /[^\xff]((?1))/BI abcd + +# These tests don't behave the same with JIT + +/\w+(?C1)/BI,no_auto_possess + abc\=callout_fail=1 + +/(*NO_AUTO_POSSESS)\w+(?C1)/BI + abc\=callout_fail=1 # End of testinput15 diff --git a/testdata/testoutput15 b/testdata/testoutput15 index 3428de0..0dad75a 100644 --- a/testdata/testoutput15 +++ b/testdata/testoutput15 @@ -330,5 +330,54 @@ Capturing subpattern count = 1 Subject length lower bound = 1 abcd Failed: error -52: nested recursion at the same subject position + +# These tests don't behave the same with JIT + +/\w+(?C1)/BI,no_auto_possess +------------------------------------------------------------------ + Bra + \w+ + Callout 1 8 0 + Ket + End +------------------------------------------------------------------ +Capturing subpattern count = 0 +Options: no_auto_possess +Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P + Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z +Subject length lower bound = 1 + abc\=callout_fail=1 +--->abc + 1 ^ ^ + 1 ^ ^ + 1 ^^ + 1 ^ ^ + 1 ^^ + 1 ^^ +No match + +/(*NO_AUTO_POSSESS)\w+(?C1)/BI +------------------------------------------------------------------ + Bra + \w+ + Callout 1 26 0 + Ket + End +------------------------------------------------------------------ +Capturing subpattern count = 0 +Compile options: +Overall options: no_auto_possess +Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P + Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z +Subject length lower bound = 1 + abc\=callout_fail=1 +--->abc + 1 ^ ^ + 1 ^ ^ + 1 ^^ + 1 ^ ^ + 1 ^^ + 1 ^^ +No match # End of testinput15 diff --git a/testdata/testoutput2 b/testdata/testoutput2 index d747e06..113c725 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -8830,7 +8830,7 @@ No match /(*NO_AUTO_POSSESS)a+b/B ------------------------------------------------------------------ Bra - a++ + a+ b Ket End