CWE-681

Incorrect Conversion between Numeric Types
AI Translation Available

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.

Status
draft
Abstraction
base
Likelihood
high
C Not Language-Specific

Common Consequences

other integrity
Impacts
unexpected state quality degradation

Detection Methods

automated static analysis

Potential Mitigations

Phases:
implementation
Descriptions:
• Avoid making conversion between numeric types. Always check for the allowed ranges.