From efccc0dc2311ef21cb10334a2594616f340a415f Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sat, 11 Apr 2026 22:50:39 +0100 Subject: [PATCH] debug-generator: assert breakpoint type is valid before bit shift The BreakpointType enum includes _BREAKPOINT_TYPE_INVALID (-EINVAL), so Coverity flags the bit shift as potentially using a negative shift amount. Add an assert to verify the type is in valid range, since the static table only contains valid entries. CID#1568482 Follow-up for 1929226e7e649b72f3f9acd464eaac771c00945c --- src/debug-generator/debug-generator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index e3b7768fbc..9ef271343c 100644 --- a/src/debug-generator/debug-generator.c +++ b/src/debug-generator/debug-generator.c @@ -101,6 +101,7 @@ static int parse_breakpoint_from_string(const char *s, uint32_t *ret_breakpoints FOREACH_ELEMENT(i, breakpoint_info_table) if (FLAGS_SET(i->validity, BREAKPOINT_DEFAULT) && breakpoint_applies(i, INT_MAX)) { + assert(i->type >= 0 && i->type < _BREAKPOINT_TYPE_MAX); /* silence coverity */ breakpoints |= UINT32_C(1) << i->type; found_default = true; break;