CWEweakness
CWE-197 Numeric Truncation Error
Low
Official page ↗
- Abstraction
- Base
- Structure
- Simple
- Status
- Incomplete
- Likelihood of exploit
- Low
- Languages
- C, C#, C++, Java, Python
- CWE version
- 5.0
Description
Truncation errors occur when a primitive is cast to a primitive of a smaller size and data is lost in the conversion.
Common consequences
• Integrity: Modify Memory, Varies by Context — When a primitive is cast to a smaller primitive, the high order bits of the large value are lost in the conversion, potentially resulting in an unexpected value that is not equal to the original value. This value may be required as an index into a buffer, a loop iterator, or simply necessary state data. In any case, the value cannot be trusted and the system will be in an undefined state.
Potential mitigations
• [Implementation] Ensure that no casts, implicit or explicit, take place that move from a larger size primitive or a smaller size primitive.
Detection methods
• Fuzzing: Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
• 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.)
Observed examples
• CVE-2020-17087: Chain: integer truncation (CWE-197) causes small buffer allocation (CWE-131) leading to out-of-bounds write (CWE-787) in kernel pool, as exploited in the wild per CISA KEV.
• CVE-2009-0231: Integer truncation of length value leads to heap-based buffer overflow.
• CVE-2008-3282: Size of a particular type changes for 64-bit platforms, leading to an integer truncation in document processor causes incorrect index to be generated.
Related
Observed example · CVE (3)
- CVE-2020-17087 Windows Kernel Local Elevation of Privilege Vulnerability vulnerability
- CVE-2009-0231 The Embedded OpenType (EOT) Font Engine (T2EMBED.DLL) in Microsoft Windows 2000 SP4, XP SP2 and SP3, Server 2003 SP2, Vista Gold, SP1, and… vulnerability
- CVE-2008-3282 Integer overflow in the rtl_allocateMemory function in sal/rtl/source/alloc_global.c in the memory allocator in OpenOffice.org (OOo) 2.4.1,… vulnerability
Can also be · CWE (4)
Child of · CWE (1)
- CWE-681 Incorrect Conversion between Numeric Types weakness
Referenced by CVE · weakness (98)
- CVE-2026-116742 HTSlib through 1.24 contains a heap out-of-bounds write and read vulnerability in bgzf_index_load_hfile() in bgzf.c that allows attackers… vulnerability
- CVE-2026-116012 Ghidra before 12.2 contains a numeric truncation vulnerability in PackedDecode::skipAttribute and skipAttributeRemaining in marshal.cc that… vulnerability
- CVE-2026-115889 Wasmtime is a runtime for WebAssembly. vulnerability
- CVE-2026-109588 Numeric truncation of the buffer length in the MPU buffer authorization check in FreeRTOS-Kernel V11.3.0 and V11.3.1 on the Arm Cortex-R82… vulnerability
- CVE-2026-108450 Heap-based buffer overflow in Microsoft Office Word allows an unauthorized attacker to execute code over a network. vulnerability
- CVE-2026-108451 Numeric truncation error in Microsoft Office Word allows an unauthorized attacker to execute code over a network. vulnerability
- CVE-2026-111105 Telegram rlottie Numeric Truncation Remote Code Execution Vulnerability. vulnerability
- CVE-2026-102043 A Numeric Truncation Error vulnerability in the rpd process of Juniper Networks Junos OS and Junos OS Evolved allows an adjacent attacker… vulnerability
- CVE-2026-33795 A Numeric Truncation Error vulnerability in the rpd process of Juniper Networks Junos OS and Junos OS Evolved allows an unauthenticated… vulnerability
- CVE-2026-100201 Heap-based buffer overflow in Windows Client License Service allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-102225 Out-of-bounds read in Windows Text Shaping allows an unauthorized attacker to execute code over a network. vulnerability
- CVE-2026-70123 Numeric truncation error in Microsoft Graphics Component allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-70177 Numeric truncation error in Microsoft Windows Search Component allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-85796 Numeric truncation error in Windows Installer allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-96113 Heap-based buffer overflow in DNS Server allows an unauthorized attacker to execute code over a network. vulnerability
- CVE-2026-96995 Stack-based buffer overflow in Microsoft Office Word allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-105768 apko allows users to build and publish OCI container images built from apk packages. vulnerability
- CVE-2026-101085 Nezha before 2.3.8 fails to validate alert rule type and duration bounds, allowing authenticated non-administrator users to create… vulnerability
- CVE-2026-96280 The OCI delta stream parser read sizes as guint64 but passed them to GLib I/O and allocation functions expecting gsize (32 bits on 32-bit… vulnerability
- CVE-2026-63449 Suricata is a network Intrusion Detection System, Intrusion Prevention System and Network Security Monitoring engine. vulnerability
- CVE-2026-19667 If an attacker-controlled authoritative server can produce a negative answer that is exactly 65536 bytes, then a flaw in `named` results in… vulnerability
- CVE-2026-76151 Out-of-bounds read (buffer over-read) in the HTTP Cache-Control response header parsing in the QtNetwork module in Qt Group Qt 6.0.0… vulnerability
- CVE-2026-87529 Numeric truncation error in Media in Google Chrome prior to 153.0.8010.36 allowed a remote attacker to potentially execute arbitrary code… vulnerability
- CVE-2026-68880 Heap-based buffer overflow in Windows Win32K allows an authorized attacker to elevate privileges over a network. vulnerability
- CVE-2026-68895 Numeric truncation error in Internet Storage Name Service allows an authorized attacker to disclose information locally. vulnerability
- CVE-2026-69512 Heap-based buffer overflow in Windows Spaceport.sys allows an authorized attacker to elevate privileges over a network. vulnerability
- CVE-2026-69535 Numeric truncation error in Windows Spaceport.sys allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-69578 Numeric truncation error in Windows Kernel allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-69822 Numeric truncation error in Windows Kerberos allows an authorized attacker to elevate privileges locally. vulnerability
- CVE-2026-78512 Numeric truncation error in Microsoft Office Word allows an unauthorized attacker to execute code over a network. vulnerability