diff --git a/src/detect-engine.c b/src/detect-engine.c index 51bb3e25f2..a204b1475d 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -85,9 +85,6 @@ #define DETECT_ENGINE_DEFAULT_INSPECTION_RECURSION_LIMIT 3000 -static DetectEngineThreadCtx *DetectEngineThreadCtxInitForReload( - ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt); - static int DetectEngineCtxLoadConf(DetectEngineCtx *); static DetectEngineMasterCtx g_master_de_ctx = { SCMUTEX_INITIALIZER, @@ -2835,7 +2832,7 @@ TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data) * * \retval det_ctx detection engine thread ctx or NULL in case of error */ -static DetectEngineThreadCtx *DetectEngineThreadCtxInitForReload( +DetectEngineThreadCtx *DetectEngineThreadCtxInitForReload( ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt) { DetectEngineThreadCtx *det_ctx = SCMalloc(sizeof(DetectEngineThreadCtx)); diff --git a/src/detect-engine.h b/src/detect-engine.h index d4047e44db..f952669ba8 100644 --- a/src/detect-engine.h +++ b/src/detect-engine.h @@ -166,4 +166,7 @@ int DetectEngineMustParseMetadata(void); int WARN_UNUSED DetectBufferSetActiveList(Signature *s, const int list); int DetectBufferGetActiveList(DetectEngineCtx *de_ctx, Signature *s); +DetectEngineThreadCtx *DetectEngineThreadCtxInitForReload( + ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt); + #endif /* __DETECT_ENGINE_H__ */ diff --git a/src/tests/fuzz/fuzz_sigpcap_aware.c b/src/tests/fuzz/fuzz_sigpcap_aware.c index 3d9dcdfc5c..2c46a098e9 100644 --- a/src/tests/fuzz/fuzz_sigpcap_aware.c +++ b/src/tests/fuzz/fuzz_sigpcap_aware.c @@ -138,6 +138,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) if (DetectEngineReload(&surifuzz) < 0) { return 0; } + DetectEngineThreadCtx *old_det_ctx = FlowWorkerGetDetectCtxPtr(fwd); + + DetectEngineCtx *de_ctx = DetectEngineGetCurrent(); + de_ctx->ref_cnt--; + DetectEngineThreadCtx *new_det_ctx = DetectEngineThreadCtxInitForReload(&tv, de_ctx, 1); + FlowWorkerReplaceDetectCtx(fwd, new_det_ctx); + + DetectEngineThreadCtxDeinit(NULL, old_det_ctx); // loop over packets r = FPC_next(&pkts, &header, &pkt);