We have a case where OutOfBounds is incorrectly detected by SonarCloud.
Where do we report this?
uint16_t outofbounds(uint16_t in, uint16_t l) {
uint16_t arr[5] = { 0 };
uint16_t b = 0;
for (uint16_t a = in; a < l; a++) {
switch (a) {
case 1000 ... 1004:
b = arr[a - 1000U]; // Out of bound
b = arr[a - 1000]; // OK
b = arr[(a - 1000U) & 0xFF]; // OK
break;
case 2000:
case 2001:
case 2002:
case 2003:
case 2004:
b = arr[a - 2000U]; // OK
b = arr[a - 2000]; // OK
break;
default:
break;
}
}
return b;
}