From: Justin Viiret Date: Mon, 23 May 2016 03:57:50 +0000 (+1000) Subject: mpm-hs: make errors from hs_scan() fatal X-Git-Tag: suricata-3.1RC1~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24a1488591e67c52db7ef0ebc2c0fd020bcf9db6;p=thirdparty%2Fsuricata.git 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. --- 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; }