...
The intent of the expression in this noncompliant code example is to add the variable OFFSET with the result of the bitwise and between x and MASK.
Code Block | ||
---|---|---|
| ||
public static final int MASK = 1337;
public static final int OFFSET = -1337;
public static int computeCode(int x) {
return x & MASK + OFFSET;
}
|
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
EXP01-J. Do not depend on operator precedence while using expressions containing side-effects
Other Languages
This rule appears in the C++ and C Secure Coding Standard as EXP00-CPP. Use parentheses for precedence of operation. and EXP00-C. Use parentheses for precedence of operation..
...