From: Luca Boccassi Date: Sat, 11 Apr 2026 21:50:39 +0000 (+0100) Subject: debug-generator: assert breakpoint type is valid before bit shift X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efccc0dc2311ef21cb10334a2594616f340a415f;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c index e3b7768fbc8..9ef271343cc 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;