...
In this compliant solution, length is subtracted from SIZE_MAX, ensuring that wrapping cannot occur, see . See guideline INT30-C. Ensure that unsigned integer operations do not wrap.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
|---|---|---|---|---|---|
INT35-C | high | likely | medium | P18 | L1 |
Automated Detection
Tool | Version | Checker | Description |
|---|---|---|---|
|
...
|
...
|
|
...
| |||||||
|
|
|
|
...
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Other Languages
Related Guidelines
This rule appears in the C++ Secure Coding Standard as : INT35-CPP. Evaluate integer expressions in a larger size before comparing or assigning to that size.
Bibliography
| Wiki Markup |
|---|
\[[Dowd 062006|AA. Bibliography#Dowd 06]\] Chapter 6, "C Language Issues" \[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.3.1, "Arithmetic operands" \[[ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] "FLC Numeric Conversion Errors" \[[MITRE 072007|AA. Bibliography#MITRE 07]\] [CWE ID 681|http://cwe.mitre.org/data/definitions/681.html], "Incorrect Conversion between Numeric Types," and [CWE ID 190|http://cwe.mitre.org/data/definitions/190.html], "Integer Overflow (Wrap or Wraparound)" \[[Seacord 05a2005a|AA. Bibliography#Seacord 05a]\] Chapter 5, "Integer Security" |
...