From 697cf5f602dbed25f743e0feed4749f326f62581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Herczeg?= Date: Mon, 10 Feb 2020 10:18:01 +0000 Subject: [PATCH] Fix control verb chain restoration issue in JIT. --- ChangeLog | 3 +++ src/pcre2_jit_compile.c | 8 ++++---- src/pcre2_jit_test.c | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6b011f..68f4fc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,6 +60,9 @@ parsed_skip()" could result. nested groups for starting code units, in order to avoid stack overflow issues. If the limit is reached, it just gives up trying for this optimization. +16. The control verb chain list must always be restored when exiting from a +recurse function in JIT. + Version 10.34 21-November-2019 ------------------------------ diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c index 7874fac..10665a8 100644 --- a/src/pcre2_jit_compile.c +++ b/src/pcre2_jit_compile.c @@ -2693,8 +2693,8 @@ while (cc < ccend) } if (common->control_head_ptr != 0 && !control_head_found) { - shared_srcw[0] = common->control_head_ptr; - shared_count = 1; + private_srcw[0] = common->control_head_ptr; + private_count = 1; control_head_found = TRUE; } cc += 1 + 2 + cc[1]; @@ -2704,8 +2704,8 @@ while (cc < ccend) SLJIT_ASSERT(common->control_head_ptr != 0); if (!control_head_found) { - shared_srcw[0] = common->control_head_ptr; - shared_count = 1; + private_srcw[0] = common->control_head_ptr; + private_count = 1; control_head_found = TRUE; } cc++; diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c index a188724..187e565 100644 --- a/src/pcre2_jit_test.c +++ b/src/pcre2_jit_test.c @@ -861,6 +861,7 @@ static struct regression_test_case regression_test_cases[] = { { MU, A, 0, 0 | F_NOMATCH, "(?(?=a)a(*THEN)b|ad)", "ad" }, { MU, A, 0, 0, "(?!(?(?=a)ab|b(*THEN)d))bn|bnn", "bnn" }, { MU, A, 0, 0, "(?=(*THEN: ))* ", " " }, + { MU, A, 0, 0, "a(*THEN)(?R) |", "a" }, /* Recurse and control verbs. */ { MU, A, 0, 0, "(a(*ACCEPT)b){0}a(?1)b", "aacaabb" },