Skip to content

Commit

Permalink
match: also restore originally unset entries in recursion (#300)
Browse files Browse the repository at this point in the history
A regresion from ~10.30 not affecting JIT
  • Loading branch information
carenas committed Oct 3, 2023
1 parent 4a2bf0c commit 794245e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pcre2_match.c
Original file line number Diff line number Diff line change
Expand Up @@ -5953,7 +5953,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
{
P = (heapframe *)((char *)N - frame_size);
memcpy((char *)F + offsetof(heapframe, ovector), P->ovector,
P->offset_top * sizeof(PCRE2_SIZE));
Foffset_top * sizeof(PCRE2_SIZE));
Foffset_top = P->offset_top;
Fcapture_last = P->capture_last;
Fcurrent_recurse = P->current_recurse;
Expand Down
3 changes: 3 additions & 0 deletions testdata/testinput1
Original file line number Diff line number Diff line change
Expand Up @@ -4372,6 +4372,9 @@
/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
abcd

/(?<all>(?:(?:a(?&all))|(b))(c?))/
aabc

/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
(?(DEFINE)
(?<NAME_PAT>[a-z]+)
Expand Down
7 changes: 7 additions & 0 deletions testdata/testoutput1
Original file line number Diff line number Diff line change
Expand Up @@ -6948,6 +6948,13 @@ No match
abcd
0: ab

/(?<all>(?:(?:a(?&all))|(b))(c?))/
aabc
0: aabc
1: aabc
2: <unset>
3:

/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
(?(DEFINE)
(?<NAME_PAT>[a-z]+)
Expand Down

0 comments on commit 794245e

Please sign in to comment.