---
title: "CWE-191: Integer Underflow (Wrap or Wraparound)"
url: https://radicalnotion.ai/cwe/cwe-191
type: cwe
description: "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."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-191: Integer Underflow (Wrap or Wraparound)

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 651
- **Of those, in CISA KEV:** 2
- **New in 2026:** 305
- **CWE catalog version:** 4.21

## Description

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.

This can happen in signed and unsigned cases.

## Alternate terms

- Integer underflow

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** C (Undetermined), C++ (Undetermined), Java (Undetermined), C# (Undetermined), Python (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Availability | DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Instability | This weakness will generally lead to undefined behavior and therefore crashes. In the case of overflows involving loop index variables, the likelihood of infinite loops is also high. |
| Integrity | Modify Memory | If the value in question is important to data (as opposed to flow), simple data corruption has occurred. Also, if the wrap around results in other conditions such as buffer overflows, further memory corruption may occur. |
| Confidentiality, Availability, Access Control | Execute Unauthorized Code or Commands, Bypass Protection Mechanism | This weakness can sometimes trigger buffer overflows which can be used to execute arbitrary code. This is usually outside the scope of a program's implicit security policy. |

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Effectiveness: High

## Demonstrative examples

### Example 1

The following example subtracts from a 32 bit signed integer.

Bad code:

```c
#include <stdio.h>
#include <stdbool.h>
main (void)
{
    int i;
    i = -2147483648;
    i = i - 1;
    return 0;
}
```

The example has an integer underflow. The value of i is already at the lowest negative value possible, so after subtracting 1, the new value of i is 2147483647.

### Example 2

This code performs a stack allocation based on a length calculation.

Bad code:

```c
int a = 5, b = 6;
size_t len = a - b;
char buf[len];    // Just blows up the stack
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2004-0816 | Integer underflow in firewall via malformed packet. |
| CVE-2004-1002 | Integer underflow by packet with invalid length. |
| CVE-2005-0199 | Long input causes incorrect length calculation. |
| CVE-2005-1891 | Malformed icon causes integer underflow in loop counter variable. |

## Real CVEs with this weakness (sample of 12 of 651)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2014-0497 | Adobe Flash Player Integer Underflow Vulnerablity | critical | 9.4 | - | Yes | 2014-02-05 |
| CVE-2021-31956 | Windows NTFS Elevation of Privilege Vulnerability | high | 8.5 | - | Yes | 2021-06-08 |
| CVE-2007-0063 | security flaw | critical | 10.0 | - | No | 2007-09-21 |
| CVE-2026-59090 | Gimp: gimp: arbitrary code execution in psd plugin due to unsigned underflow | critical | 9.9 | - | No | 2026-08-10 |
| CVE-2026-85806 | Network Policy Server (NPS) Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-10-13 |
| CVE-2026-83869 | Windows Domain Name Service Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-10-13 |
| CVE-2026-83578 | Microsoft PowerShell Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-10-13 |
| CVE-2026-98177 | drm/amdkfd: Avoid integer underflow in EOP ring size calculation. | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-98176 | drm/amdkfd: Avoid integer underflow with ffs in EOP ring size calc | critical | 9.8 | - | No | 2026-10-06 |
| CVE-2026-97413 | RDMA/rtrs-srv: Fix integer underflow in process\_read and process\_write | critical | 9.8 | - | No | 2026-09-24 |
| CVE-2026-69824 | Microsoft Standard XPS Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-09-08 |
| CVE-2026-69276 | Microsoft UxTheme Library (uxtheme.dll) Remote Code Execution Vulnerability | critical | 9.8 | - | No | 2026-09-08 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-682](https://radicalnotion.ai/cwe/cwe-682) | Incorrect Calculation |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Integer underflow (wrap or wraparound) | - | - |
| Software Fault Patterns | Glitch in computation | SFP1 | - |
| CERT C Secure Coding | Ensure that unsigned integer operations do not wrap | INT30-C | Imprecise |
| CERT C Secure Coding | Ensure that operations on signed integers do not result in overflow | INT32-C | Imprecise |
| OpenSSF Secure Coding Guide for Python | Guard Fixed-Width Numbers Against Overflow | pyscg-0002 | - |

## Frequently asked questions

### What is CWE-191?

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.

### What CVEs are caused by CWE-191?

651 recorded CVEs are attributed to CWE-191, including CVE-2014-0497, CVE-2021-31956 and CVE-2007-0063. 2 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How is CWE-191 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-191?

Exploiting CWE-191 can lead to: DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Instability, Modify Memory, Execute Unauthorized Code or Commands.

### Is CWE-191 actively exploited?

Yes. 2 CWE-191 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 651 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/191.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-191). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
