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 1929226e7e
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user