Closed
Description
Affected rules
A4-7-1
Description
The IntegerExpressionLeadToDataLoss.ql
query does not detect/identify guards for shift operations.
We already implement appropriate guards in the C rule INT34-C
, and we should consider combining the implementations.
Example
std::size_t pow2(std::size_t i) {
if (i < (sizeof(std::size_t) * CHAR_BIT)) {
constexpr std::size_t one{1};
return one << i; // COMPLIANT
}
}