---
title: "CWE-196: Unsigned to Signed Conversion Error"
url: https://radicalnotion.ai/cwe/cwe-196
type: cwe
description: "The product uses an unsigned primitive and performs a cast to a signed primitive, which can produce an unexpected value if the value of the unsigned primitive can not be represented using a signed primitive."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-196: Unsigned to Signed Conversion Error

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** Medium
- **CVEs with this as primary weakness:** 8
- **Of those, in CISA KEV:** 0
- **New in 2026:** 6
- **CWE catalog version:** 4.21

## Description

The product uses an unsigned primitive and performs a cast to a signed primitive, which can produce an unexpected value if the value of the unsigned primitive can not be represented using a signed primitive.

## Modes of introduction

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

## Applicable platforms

**Languages:** C (Undetermined), C++ (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Availability | DoS: Crash, Exit, or Restart | Incorrect sign conversions generally lead to undefined behavior, and therefore crashes. |
| Integrity | Modify Memory | If a poor cast leads to a buffer overflow or similar condition, data integrity may be affected. This can be a precursor to dangerous buffer underwrite conditions that allow attackers to move down the stack where they otherwise might not have access in a normal buffer overflow condition. Buffer underwrites occur frequently when large unsigned values are cast to signed values, and then used as indexes into a buffer or for pointer arithmetic. |
| Integrity, Confidentiality, Availability, Access Control | Execute Unauthorized Code or Commands, Bypass Protection Mechanism | Improper signed-to-unsigned conversions without proper checking 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. |

## Potential mitigations

### Requirements

Choose a language which is not subject to these casting flaws.

### Architecture and Design

Design object accessor functions to implicitly check values for valid sizes. Ensure that all functions which will be used as a size are checked previous to use as a size. If the language permits, throw exceptions rather than using in-band errors.

### Implementation

Error check the return values of all functions. Be aware of implicit casts made, and use unsigned variables for sizes if at all possible.

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

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-14454 | Imager versions before 1.033 for Perl treat unsigned EXIF IFD entry counts as signed | critical | 9.8 | - | No | 2026-07-08 |
| CVE-2026-93019 | Imager versions before 1.036 for Perl exit the process reading a TGA with a colour map length of 32768 or more in tga\_palette\_read | critical | 9.1 | - | No | 2026-09-18 |
| CVE-2020-13545 | SoftMaker Office TextMaker Document Record 0x003f integer conversion vulnerability | high | 7.8 | - | No | 2021-01-06 |
| CVE-2026-106567 | ImageMagick: Infinite Loop in PSD decoder on 32-bit builds | high | 7.5 | - | No | 2026-10-07 |
| CVE-2026-34155 | RAUC: Improper Signing of Plain Bundles Exceeding 2 GiB | high | 7.2 | - | No | 2026-03-31 |
| CVE-2023-0185 | - | high | 7.1 | - | No | 2023-04-01 |
| CVE-2026-120457 | libaec through 1.1.7 Out-of-Bounds Read via m\_se\_decode() Second Extension Decoder | medium | 5.8 | - | No | 2026-11-02 |
| CVE-2026-58317 | Unsigned to Signed Conversion Error in TTSSH2 | medium | 5.1 | - | No | 2026-07-17 |

## Related attack patterns (CAPEC)

- [CAPEC-92](https://radicalnotion.ai/capec/capec-92): Forced Integer Overflow

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-681](https://radicalnotion.ai/cwe/cwe-681) | Incorrect Conversion between Numeric Types |
| Can precede | [CWE-124](https://radicalnotion.ai/cwe/cwe-124) | Buffer Underwrite |
| Related | [CWE-197](https://radicalnotion.ai/cwe/cwe-197) | Numeric Truncation Error |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| CLASP | Unsigned to signed conversion error | - | - |
| Software Fault Patterns | Glitch in computation | SFP1 | - |

## Frequently asked questions

### What is CWE-196?

The product uses an unsigned primitive and performs a cast to a signed primitive, which can produce an unexpected value if the value of the unsigned primitive can not be represented using a signed primitive.

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

8 recorded CVEs are attributed to CWE-196, including CVE-2026-14454, CVE-2026-93019 and CVE-2020-13545.

### How do you prevent CWE-196?

Choose a language which is not subject to these casting flaws.

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

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

### Is CWE-196 actively exploited?

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

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

---

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