From ed0e58f5409035bf2d375e27168c4ebb287621c2 Mon Sep 17 00:00:00 2001 From: Zoltan Herczeg Date: Thu, 21 May 2026 05:56:00 +0200 Subject: [PATCH] Backport of pcre2-10.48-Fix-JIT-STR_END.patch Cherry-pick of ff92e0b9cea5b5ae3af12ba930d03556684f098b Fix setting STR_END in JIT (#912) When OP_VREVERSE is present in a non-atomic LOOKBEHIND ASSERTION, the STR_END must be set before the backtracking path is executed. --- src/pcre2_jit_compile.c | 2 ++ src/pcre2_jit_test.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c index 050063ec..6db013d3 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -13134,6 +13134,8 @@ if (offset != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP2, 0); } } +else if (SLJIT_UNLIKELY(opcode == OP_ASSERTBACK_NA) && PRIVATE_DATA(ccbegin + 1)) + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr); if (SLJIT_UNLIKELY(opcode == OP_ONCE)) { diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c index 54ce32f7..ef5bd8e5 100644 --- a/src/pcre2_jit_test.c +++ b/src/pcre2_jit_test.c @@ -638,6 +638,7 @@ static struct regression_test_case regression_test_cases[] = { { MU, A, 0, 0, "a(?=)b", "ab" }, { MU, A, 0, 0 | F_NOMATCH, "a(?!)b", "ab" }, { MU, A, 0, 0, "(?(?