Fix (*NO_AUTO_POSSESS)

This commit is contained in:
Philip.Hazel 2015-11-05 18:03:16 +00:00
parent b7ee0684e3
commit 2909e2411c
5 changed files with 61 additions and 2 deletions

View File

@ -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
--------------------------

View File

@ -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;

View File

@ -152,4 +152,12 @@
/[^\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

49
testdata/testoutput15 vendored
View File

@ -331,4 +331,53 @@ 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: <none>
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

View File

@ -8830,7 +8830,7 @@ No match
/(*NO_AUTO_POSSESS)a+b/B
------------------------------------------------------------------
Bra
a++
a+
b
Ket
End