CWE-128

Wrap-around Error
AI Translation Available

Wrap around errors occur whenever a value is incremented past the maximum value for its type and therefore 'wraps around' to a very small, negative, or undefined value.

Status
incomplete
Abstraction
base
Likelihood
medium
C C++

Common Consequences

availability integrity confidentiality access control
Impacts
dos: crash, exit, or restart dos: resource consumption (cpu) dos: resource consumption (memory) dos: instability modify memory execute unauthorized code or commands bypass protection mechanism

Detection Methods

automated static analysis

Potential Mitigations

Phases:
architecture and design implementation
Descriptions:
• Requirements specification: The choice could be made to use a language that is not susceptible to these issues.
• Perform validation on all incremented variables to ensure that they remain within reasonable bounds.
• Provide clear upper and lower bounds on the scale of any protocols designed.