mpm-hs,spm-hs: don't call hs_scan() for zero bytes

pull/2115/head
Justin Viiret 10 years ago committed by Victor Julien
parent 2a5f487a16
commit a765cfde19

@ -919,6 +919,10 @@ uint32_t SCHSSearch(const MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx,
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. */

@ -141,6 +141,10 @@ static uint8_t *HSScan(const SpmCtx *ctx, SpmThreadCtx *thread_ctx,
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);

Loading…
Cancel
Save