From: Shivani Bhardwaj Date: Tue, 5 Aug 2025 10:32:16 +0000 (+0530) Subject: detect/port: add BUG_ON on impossible condition X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=982c9222dd58ca5c7f685cadbae4eb8d966f970e;p=thirdparty%2Fsuricata.git detect/port: add BUG_ON on impossible condition to assist Coverity in assessing the state of x correctly. --- diff --git a/src/detect-engine-port.c b/src/detect-engine-port.c index 7d8b15a22c..07b0ebc13a 100644 --- a/src/detect-engine-port.c +++ b/src/detect-engine-port.c @@ -807,6 +807,7 @@ static int DetectPortParseDo(const DetectEngineCtx *de_ctx, } else if (!o_set && s[u] == '!') { SCLogDebug("negation encountered"); n_set = 1; + BUG_ON(x == 0); /* always false; added to guide static code analyzers like Coverity */ x--; } else if (s[u] == '[') { if (!o_set) {