SCHSThreadCtx *hs_thread_ctx = (SCHSThreadCtx *)(mpm_thread_ctx->ctx);
const PatternDatabase *pd = ctx->pattern_db;
+ if (unlikely(buflen == 0)) {
+ return 0;
+ }
+
SCHSCallbackCtx cctx = {.ctx = ctx, .pmq = pmq, .match_count = 0};
/* scratch should have been cloned from g_scratch_proto at thread init. */
const SpmHsCtx *sctx = ctx->ctx;
hs_scratch_t *scratch = thread_ctx->ctx;
+ if (unlikely(haystack_len == 0)) {
+ return NULL;
+ }
+
uint64_t match_offset = UINT64_MAX;
hs_error_t err = hs_scan(sctx->db, (const char *)haystack, haystack_len, 0,
scratch, MatchEvent, &match_offset);