Integer Underflow (Wrap or Wraparound)
Weakness ID: 191 (Weakness Base)Status: Draft
+ Description

Description Summary

The product subtracts one value from another, such that the result is less than the minimum allowable integer value, which produces a value that is not equal to the correct result.

Extended Description

This can happen in signed and unsigned cases.

+ Alternate Terms
Integer underflow:

"Integer underflow" is sometimes used to identify signedness errors in which an originally positive number becomes negative as a result of subtraction. However, there are cases of bad subtraction in which unsigned integers are involved, so it's not always a signedness issue.

"Integer underflow" is occasionally used to describe array index errors in which the index is negative.

+ Time of Introduction
  • Implementation
+ Applicable Platforms






+ Demonstrative Examples

Example 1

The following example has an integer underflow. The value of i is already at the lowest negative value possible. The new value of i is 2147483647.

(Bad Code)
Example Language:
#include <stdio.h>
#include <stdbool.h>
main (void)
int i;
unsigned int j = 0;
i = -2147483648;
i = i - 1;
j = j - 1;
return 0;

+ Observed Examples
CVE-2004-0816Integer underflow in firewall via malformed packet.
CVE-2004-1002Integer underflow by packet with invalid length.
CVE-2005-0199Long input causes incorrect length calculation.
CVE-2005-1891Malformed icon causes integer underflow in loop counter variable.
+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness Class682Incorrect Calculation
Development Concepts (primary)699
Research Concepts (primary)1000
+ Research Gaps


+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
PLOVERInteger underflow (wrap or wraparound)
+ Content History
Submission DateSubmitterOrganizationSource
PLOVERExternally Mined
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Demonstrative Example
2008-09-08CWE Content TeamMITREInternal
updated Alternate Terms, Applicable Platforms, Relationships, Taxonomy Mappings
2008-10-14CWE Content TeamMITREInternal
updated Description
2009-05-27CWE Content TeamMITREInternal
updated Demonstrative Examples