diff --git a/ChangeLog b/ChangeLog index 5933f06..5ef9a46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,9 @@ some minor bugs and Perl incompatibilities were fixed, including: existing subpattern. (e) A conditional recursion test such as (?(R)...) misbehaved if there was a group whose name began with "R". + (f) The amount of memory needed for a compiled pattern was miscalculated if a + lookbehind contained more than one toplevel branch and the first branch + was of length zero. One effect of the refactoring is that some error numbers and messages have changed, and the pattern offset given for compiling errors is not always the diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index b7df32d..b120ab0 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -7584,11 +7584,12 @@ for (;;) PUT(code, 1, (int)(code - last_branch)); bc.current_branch = last_branch = code; code += 1 + LINK_SIZE; - lookbehindlength = META_DATA(*pptr); } - /* Advance past the vertical bar */ + /* Set the lookbehind length (if not in a lookbehind the value will be zero) + and then advance past the vertical bar. */ + lookbehindlength = META_DATA(*pptr); pptr++; } /* Control never reaches here */ diff --git a/testdata/testinput2 b/testdata/testinput2 index ba7df01..fc16bec 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -4896,4 +4896,8 @@ a)"xI /()(?<=(?0))/ +/(?