Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 88

...

Code Block
bgColor#ccccff
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.

...