---
title: "CWE-680: Integer Overflow to Buffer Overflow"
url: https://radicalnotion.ai/cwe/cwe-680
type: cwe
description: "The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-680: Integer Overflow to Buffer Overflow

- **Abstraction:** Compound
- **Structure:** Chain
- **Status:** Draft
- **CVEs with this as primary weakness:** 104
- **Of those, in CISA KEV:** 0
- **New in 2026:** 9
- **CWE catalog version:** 4.21

## Description

The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow.

## Modes of introduction

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

## Applicable platforms

**Languages:** Memory-Unsafe (Undetermined), C (Often), C++ (Often)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Availability, Confidentiality | Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands | - |

## 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

### Automated Dynamic Analysis

Use tools that are integrated during compilation to insert runtime error-checking mechanisms related to memory safety errors, such as AddressSanitizer (ASan) for C/C++ \[REF-1518\].

Effectiveness: Moderate. Crafted inputs are necessary to reach the code containing the error, such as generated by fuzzers. Also, these tools may reduce performance, and they only report the error condition - not the original mistake that led to the error.

## Demonstrative examples

### Example 1

The following image processing code allocates a table for images.

Bad code:

```c
img_t table_ptr; /*struct containing img data, 10kB each*/
int num_imgs;
...
num_imgs = get_num_imgs();
table_ptr = (img_t*)malloc(sizeof(img_t)*num_imgs);
...
```

This code intends to allocate a table of size num\_imgs, however as num\_imgs grows large, the calculation determining the size of the list will eventually overflow (CWE-190). This will result in a very small list to be allocated instead. If the subsequent code operates on the list as if it were num\_imgs long, it may result in many types of out-of-bounds problems (CWE-119).

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2021-43537 | Chain: in a web browser, an unsigned 64-bit integer is forcibly cast to a 32-bit integer (CWE-681) and potentially leading to an integer overflow (CWE-190). If an integer overflow occurs, this can cause heap memory corruption (CWE-122) |
| CVE-2017-1000121 | Chain: unchecked message size metadata allows integer overflow (CWE-190) leading to buffer overflow (CWE-119). |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-8376 | Perl versions before 5.40.5-RC1, from 5.41.0 before 5.42.3-RC1, from 5.43.0 before 5.43.11 have a heap buffer overflow when compiling regular expressions with a repeated fixed string on 32-bit builds | critical | 9.8 | - | No | 2026-05-25 |
| CVE-2024-33078 | - | critical | 9.8 | - | No | 2024-05-01 |
| CVE-2022-35289 | - | critical | 9.8 | - | No | 2022-10-11 |
| CVE-2021-40417 | Blackmagic Design DaVinci Resolve R3D DPDecoder Service frame decoding heap-based buffer overflow vulnerability | critical | 9.8 | - | No | 2021-12-22 |
| CVE-2021-21832 | Disc Soft Ltd Daemon Tools Pro ISO Parsing memory corruption vulnerability | critical | 9.8 | - | No | 2021-08-17 |
| CVE-2021-21783 | Genivia gSOAP WS-Addressing plugin code execution vulnerability redux | critical | 9.8 | - | No | 2021-03-25 |
| CVE-2020-13576 | Genivia gSOAP WS-Addressing plugin code execution vulnerability | critical | 9.8 | - | No | 2021-02-10 |
| CVE-2018-8795 | rdesktop: Remote code execution in process\_bitmap\_data | critical | 9.8 | - | No | 2019-02-05 |
| CVE-2018-8794 | rdesktop: Memory corruption in process\_bitmap\_data | critical | 9.8 | - | No | 2019-02-05 |
| CVE-2018-8786 | freerdp: Integer truncation leading to heap-based buffer overflow in update\_read\_bitmap\_update() function | critical | 9.8 | - | No | 2018-11-29 |
| CVE-2018-8787 | freerdp: Integer overflow leading to heap-based buffer overflow in gdi\_Bitmap\_Decompress() function | critical | 9.8 | - | No | 2018-11-29 |
| CVE-2026-55200 | libssh2 - Out-of-Bounds Write via Unchecked packet\_length in transport.c | critical | 9.2 | - | No | 2026-06-17 |

## Related attack patterns (CAPEC)

- [CAPEC-10](https://radicalnotion.ai/capec/capec-10): Buffer Overflow via Environment Variables
- [CAPEC-100](https://radicalnotion.ai/capec/capec-100): Overflow Buffers
- [CAPEC-14](https://radicalnotion.ai/capec/capec-14): Client-side Injection-induced Buffer Overflow
- [CAPEC-24](https://radicalnotion.ai/capec/capec-24): Filter Failure through Buffer Overflow
- [CAPEC-45](https://radicalnotion.ai/capec/capec-45): Buffer Overflow via Symbolic Links
- [CAPEC-46](https://radicalnotion.ai/capec/capec-46): Overflow Variables and Tags
- [CAPEC-47](https://radicalnotion.ai/capec/capec-47): Buffer Overflow via Parameter Expansion
- [CAPEC-67](https://radicalnotion.ai/capec/capec-67): String Format Overflow in syslog()
- [CAPEC-8](https://radicalnotion.ai/capec/capec-8): Buffer Overflow in an API Call
- [CAPEC-9](https://radicalnotion.ai/capec/capec-9): Buffer Overflow in Local Command-Line Utilities
- [CAPEC-92](https://radicalnotion.ai/capec/capec-92): Forced Integer Overflow

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-190](https://radicalnotion.ai/cwe/cwe-190) | Integer Overflow or Wraparound |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| 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 |
| CERT C Secure Coding | Allocate sufficient memory for an object | MEM35-C | CWE More Abstract |

## Frequently asked questions

### What is CWE-680?

The product performs a calculation to determine how much memory to allocate, but an integer overflow can occur that causes less memory to be allocated than expected, leading to a buffer overflow.

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

104 recorded CVEs are attributed to CWE-680, including CVE-2026-8376, CVE-2024-33078 and CVE-2022-35289.

### How is CWE-680 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-680?

Exploiting CWE-680 can lead to: Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands.

### Is CWE-680 actively exploited?

104 recorded CVEs are caused by CWE-680; none are currently in CISA's KEV catalog of actively exploited flaws.

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

---

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