From 06dcb5aeb04b39033f17b09f19ae5bf2e605e22d Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 9 May 2026 20:10:15 +0200 Subject: [PATCH] detect/flowbits: fix scan-build 0-size alloc warning detect-flowbits.c:761:29: warning: Call to 'calloc' has an allocation size of 0 bytes [optin.portability.UnixAPI] 761 | SCCalloc(sids_array_size, sizeof(uint32_t)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./util-mem.h:36:18: note: expanded from macro 'SCCalloc' 36 | #define SCCalloc calloc | ^ 1 warning generated. --- src/detect-flowbits.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/detect-flowbits.c b/src/detect-flowbits.c index 438a2915f2..6e7726020d 100644 --- a/src/detect-flowbits.c +++ b/src/detect-flowbits.c @@ -753,7 +753,9 @@ int DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx) s->init_data->init_flags |= SIG_FLAG_INIT_STATE_MATCH; s->init_data->is_rule_state_dependant = true; - uint32_t sids_array_size = array[i].set_sids_idx; + const uint32_t sids_array_size = array[i].set_sids_idx; + if (sids_array_size == 0) + continue; // save information about flowbits that affect this rule's state if (s->init_data->rule_state_dependant_sids_array == NULL) {