From 24a1488591e67c52db7ef0ebc2c0fd020bcf9db6 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Mon, 23 May 2016 13:57:50 +1000 Subject: [PATCH] mpm-hs: make errors from hs_scan() fatal Hyperscan will only return an error at scan time if the database or scratch region are corrupted, which should provoke a fatal error. --- src/util-mpm-hs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util-mpm-hs.c b/src/util-mpm-hs.c index ae0de5e0a9..61a6c4cf89 100644 --- a/src/util-mpm-hs.c +++ b/src/util-mpm-hs.c @@ -933,8 +933,11 @@ uint32_t SCHSSearch(const MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, hs_error_t err = hs_scan(pd->hs_db, (const char *)buf, buflen, 0, scratch, SCHSMatchEvent, &cctx); if (err != HS_SUCCESS) { - SCLogError(SC_ERR_FATAL, "Scanning with Hyperscan returned error %d", - err); + /* An error value (other than HS_SCAN_TERMINATED) from hs_scan() + * indicates that it was passed an invalid database or scratch region, + * which is not something we can recover from at scan time. */ + SCLogError(SC_ERR_FATAL, "Hyperscan returned error %d", err); + exit(EXIT_FAILURE); } else { ret = cctx.match_count; }