From 4d5041f82f5600107501cb971962f445571b09c3 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 16 Dec 2022 15:51:05 +0100 Subject: [PATCH] detect/pcre: don't use JIT if disabled If we determined not to use JIT at start up, really don't use JIT. Bug: #5762. --- src/detect-pcre.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/detect-pcre.c b/src/detect-pcre.c index e54e75a7b8..0c7b1aa70a 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -874,11 +874,14 @@ static int DetectPcreSetup (DetectEngineCtx *de_ctx, Signature *s, const char *r goto error; #ifdef PCRE_HAVE_JIT_EXEC - /* Deliberately silent on failures. Not having a context id means - * JIT will be bypassed */ - pd->thread_ctx_jit_stack_id = DetectRegisterThreadCtxFuncs(de_ctx, "pcre", - DetectPcreThreadInit, (void *)pd, - DetectPcreThreadFree, 1); + if (pcre_use_jit) { + /* Deliberately silent on failures. Not having a context id means + * JIT will be bypassed */ + pd->thread_ctx_jit_stack_id = DetectRegisterThreadCtxFuncs( + de_ctx, "pcre", DetectPcreThreadInit, (void *)pd, DetectPcreThreadFree, 1); + } else { + pd->thread_ctx_jit_stack_id = -1; + } #endif int sm_list = -1; -- 2.47.2