CWE
Home > CWE List > CWE-192 Individual Dictionary Definition (Draft 9)   View the CWE List

CWE-192 Individual Dictionary Definition (Draft 9)

Integer Coercion Error
Category ID
Status: Incomplete

192 (Category)

Description

Summary

Integer coercion refers to a set of flaws pertaining to the type casting, extension, or truncation of primitive data types.

Likelihood of Exploit

Medium

Common Consequences

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.

Potential Mitigations

Requirements specification: A language which throws exceptions on ambiguous data casts might be chosen.

Design: Design objects and program flow such that multiple or complex casts are unnecessary

Implementation: Ensure that any data type casting that you must used is entirely understood in order to reduce the plausibility of error in use.

Demonstrative
Examples

See the Examples section of the problem type Unsigned to signed conversion error for an example of integer coercion errors.

Context Notes

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.

Relationships
NatureTypeIDName
ChildOfCategoryCategory189Numeric Errors
CanAlsoBeWeakness VariantWeakness VariantWeakness Variant195Signed to Unsigned Conversion Error
CanAlsoBeWeakness VariantWeakness VariantWeakness Variant196Unsigned to Signed Conversion Error
CanAlsoBeWeakness BaseWeakness BaseWeakness Base197Numeric Truncation Error
CanAlsoBeWeakness BaseWeakness BaseWeakness Base194Incorrect Sign Extension
CanAlsoBeWeakness BaseWeakness BaseWeakness Base197Numeric Truncation Error
Source Taxonomies

CLASP - Integer coercion error

Applicable Platforms

C

C++

Java

.NET

Time of Introduction

Implementation

Page Last Updated: April 22, 2008