Skip to content

Commit

Permalink
Fix backreferences with unset backref and non-greedy iterators in JIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Herczeg committed Dec 7, 2023
1 parent 4e8fdb3 commit 9de4d53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ in particular k and s.

51. Fix accept and endanchored interaction in JIT.

52. Fix backreferences with unset backref and non-greedy iterators in JIT.


Version 10.42 11-December-2022
------------------------------
Expand Down
3 changes: 2 additions & 1 deletion src/pcre2_jit_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -9653,7 +9653,8 @@ else
{
if (ref)
{
add_jump(compiler, &backtrack->own_backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)));
if (!common->unset_backref)
add_jump(compiler, &backtrack->own_backtracks, CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)));
zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
}
else
Expand Down
1 change: 1 addition & 0 deletions src/pcre2_jit_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ static struct regression_test_case regression_test_cases[] = {
{ CMU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}?M", "aaaaaabbbbbbaabbbbbbbbbbm" },
{ CMU | PCRE2_DUPNAMES, A, 0, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
{ MU | PCRE2_MATCH_UNSET_BACKREF, A, 0, 0, "(a)|\\1+c", "xxc" },
{ MU | PCRE2_MATCH_UNSET_BACKREF, A, 0, 0, "\\1+?()", "" },

/* Assertions. */
{ MU, A, 0, 0, "(?=xx|yy|zz)\\w{4}", "abczzdefg" },
Expand Down

0 comments on commit 9de4d53

Please sign in to comment.