|
Status: Draft Weakness ID: 681 (Weakness Base)Description Summary When converting from one data type to another, such as long to integer, data can be omitted or translated in a way that produces unexpected values. If the resulting values are used in a sensitive context, then dangerous behaviors may occur. Potential Mitigations Avoid making conversion between numeric types. Always check for the allowed ranges. Demonstrative Examples In the following Java example, a float literal is cast to an integer, thus causing a loss of precision. Java Example: int i = (int) 33457.8f
Relationships
Taxonomy Mappings
Time of Introduction ImplementationContent History Modifications Sean Eidemiller. Cigital. 2008-07-01. (External) added/updated demonstrative examples Eric Dalci. Cigital. 2008-07-01. (External) updated Potential_Mitigations, Time_of_Introduction CWE Content Team. MITRE. 2008-09-08. (Internal) updated Relationships CWE Content Team. MITRE. 2008-11-24. (Internal) updated Description, Relationships, Taxonomy_Mappings |
|
|
|||