Skip to content

Commit

Permalink
Fix vreverse issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Herczeg committed Nov 16, 2023
1 parent 0710ce2 commit 741390c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pcre2_jit_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -9869,9 +9869,9 @@ SLJIT_ASSERT(parent->top == NULL);
if (*cc == OP_REVERSE)
{
reverse_failed = &parent->topbacktracks;
lmin = GET(cc, 1);
lmin = GET2(cc, 1);
lmax = lmin;
cc += 1 + LINK_SIZE;
cc += 1 + IMM2_SIZE;

SLJIT_ASSERT(lmin > 0);
}
Expand All @@ -9881,9 +9881,9 @@ else
PUSH_BACKTRACK(sizeof(vreverse_backtrack), cc, NULL);

reverse_failed = &backtrack->topbacktracks;
lmin = GET(cc, 1);
lmax = GET(cc, 1 + IMM2_SIZE);
cc += 1 + 2 * LINK_SIZE;
lmin = GET2(cc, 1);
lmax = GET2(cc, 1 + IMM2_SIZE);
cc += 1 + 2 * IMM2_SIZE;

SLJIT_ASSERT(lmin < lmax);
}
Expand Down Expand Up @@ -10211,7 +10211,7 @@ while (1)
if (conditional)
{
if (extrasize > 0)
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? STACK(-2) : STACK(-1));
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-end_block_size - (needs_control_head ? 2 : 1)));
}
else if (bra == OP_BRAZERO)
{
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 @@ -631,6 +631,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MU, A, 0, 0, "c(?(?!\\b|(?C)\\B(?C`x`))ab|a)", "cab" },
{ MU, A, 0, 0, "a(?=)b", "ab" },
{ MU, A, 0, 0 | F_NOMATCH, "a(?!)b", "ab" },
{ MU, A, 0, 0, "(?(?<!|(|a)))", "a" },

/* Not empty, ACCEPT, FAIL */
{ MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "a*", "bcx" },
Expand Down

0 comments on commit 741390c

Please sign in to comment.