...
Code Block | ||
---|---|---|
| ||
if(a == Integer.MIN_VALUE && b == -1) { throw new ArithmeticException("Not in range"); // May be Integer.MIN_VALUE and -1 } result = a/b; // Safe operation |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Other Languages
This rule appears in the C Secure Coding Standard as INT32-C. Ensure that operations on signed integers do not result in overflow.
...