Diagnose an overall recursion (?0) inside a lookbehind as an error.

This commit is contained in:
Philip.Hazel 2016-10-23 17:05:09 +00:00
parent d117300a1d
commit 2821076981
4 changed files with 10 additions and 1 deletions

View File

@ -96,6 +96,9 @@ only when PCRE2_NO_START_OPTIMIZE was *not* set:
16. The "offset" modifier in pcre2test was not being ignored (as documented)
when the POSIX API was in use.
17. An overall recursion such as (?0) inside a lookbehind assertion was not
being diagnosed as an error.
Version 10.22 29-July-2016
--------------------------

View File

@ -8497,12 +8497,13 @@ for (;; pptr++)
*errcodeptr = ERR15; /* Non-existent subpattern */
return -1;
}
if (group == 0) goto ISNOTFIXED; /* Local recursion */
for (gptr = cb->parsed_pattern; *gptr != META_END; gptr++)
{
if (META_CODE(*gptr) == META_BIGVALUE) gptr++;
else if (*gptr == (META_CAPTURE | group)) break;
}
gptrend = parsed_skip(gptr, PSKIP_KET);
if (pptr > gptr && pptr < gptrend) goto ISNOTFIXED; /* Local recursion */
for (r = recurses; r != NULL; r = r->prev) if (r->groupptr == gptr) break;

2
testdata/testinput2 vendored
View File

@ -4894,4 +4894,6 @@ a)"xI
/(?=.*[A-Z])/I
/()(?<=(?0))/
# End of testinput2

View File

@ -15338,6 +15338,9 @@ Capturing subpattern count = 0
May match empty string
Subject length lower bound = 0
/()(?<=(?0))/
Failed: error 125 at offset 2: lookbehind assertion is not fixed length
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data