Integer Coercion Error |
Category ID: 192 (Category) | Status: Incomplete |
Description Summary
Extended Description
Several flaws fall under the category of integer coercion errors. For the most part, these errors in and of themselves result only in availability and data integrity issues. However, in some circumstances, they may result in other, more complicated security related flaws, such as buffer overflow conditions.
Scope | Effect |
---|---|
Availability | Integer coercion often leads to undefined states of execution resulting in infinite loops or crashes. |
Access Control | In some cases, integer coercion errors can lead to exploitable buffer overflow conditions, resulting in the execution of arbitrary code. |
Integrity | Integer coercion errors result in an incorrect value being stored for the variable in question. |
Example 1
See the Examples section of the problem type Unsigned to signed conversion error for an example of integer coercion errors.
Requirements specification: A language which throws exceptions on ambiguous data casts might be chosen. |
Phase: Architecture and Design Design objects and program flow such that multiple or complex casts are unnecessary |
Phase: Implementation Ensure that any data type casting that you must used is entirely understood in order to reduce the plausibility of error in use. |
Nature | Type | ID | Name | View(s) this relationship pertains to |
---|---|---|---|---|
ChildOf | Weakness Base | 681 | Incorrect Conversion between Numeric Types | Research Concepts (primary)1000 |
ChildOf | Weakness Class | 682 | Incorrect Calculation | Development Concepts (primary)699 |
ChildOf | Category | 738 | CERT C Secure Coding Section 04 - Integers (INT) | Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734 |
CanAlsoBe | Weakness Base | 194 | Unexpected Sign Extension | Research Concepts1000 |
CanAlsoBe | Weakness Variant | 195 | Signed to Unsigned Conversion Error | Research Concepts1000 |
CanAlsoBe | Weakness Variant | 196 | Unsigned to Signed Conversion Error | Research Concepts1000 |
CanAlsoBe | Weakness Base | 197 | Numeric Truncation Error | Research Concepts1000 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
CLASP | Integer coercion error | ||
CERT C Secure Coding | INT02-C | Understand integer conversion rules | |
CERT C Secure Coding | INT05-C | Do not use input functions to convert character data if they cannot handle all possible inputs | |
CERT C Secure Coding | INT31-C | Ensure that integer conversions do not result in lost or misinterpreted data |
Within C, it might be that "coercion" is semantically different than "casting", possibly depending on whether the programmer directly specifies the conversion, or if the compiler does it implicitly. This has implications for the presentation of this node and others, such as CWE-681, and whether there is enough of a difference for these nodes to be split. |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
CLASP | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Applicable Platforms, Common Consequences, Maintenance Notes, Relationships, Other Notes, Taxonomy Mappings | ||||
2008-11-24 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings | ||||
2009-12-28 | CWE Content Team | MITRE | Internal | |
updated Description, Other Notes |