Division and modulo operations are susceptible to divide-by-zero errors. According to section 6.5.5, paragraph 5 of \ [[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Wiki Markup
The result of the
/
operator is the quotient from the division of the first operand by the second; the result of the%
operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
INT33-C | low | likely | medium | P6 | L2 |
Automated Detection
Tool | Version | Checker | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
| ||||||||||||
|
|
|
| ||||||||||||
|
|
|
|
...
MITRE CWE: CWE-369, "Divide By Zero"
Bibliography
...
\[[Seacord 2005|AA. Bibliography#Seacord 05]\] Chapter 5, "Integers"
\
[[Warren 2002|AA. Bibliography#Warren 02]\] Chapter 2, "Basics"
...
04. Integers (INT) INT34-C. Do not shift a negative number of bits or more bits than exist in the operand