From 982c9222dd58ca5c7f685cadbae4eb8d966f970e Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Tue, 5 Aug 2025 16:02:16 +0530 Subject: [PATCH] detect/port: add BUG_ON on impossible condition to assist Coverity in assessing the state of x correctly. --- src/detect-engine-port.c | 1 + 1 file changed, 1 insertion(+) 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) { -- 2.47.2