Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-197 (数值截断错误) — Vulnerability Class 39

39 vulnerabilities classified as CWE-197 (数值截断错误). AI Chinese analysis included.

CWE-197, Numeric Truncation Error, is a software weakness occurring when a value is cast from a larger primitive type to a smaller one, causing high-order bits to be discarded and resulting in data loss. This flaw is typically exploited by attackers who manipulate input values to trigger unexpected numeric conversions, potentially leading to buffer overflows, out-of-bounds memory access, or logic errors when the truncated value serves as an array index or loop iterator. Developers can prevent this vulnerability by implementing rigorous input validation to ensure values fit within the target data type’s range before casting. Additionally, using safe conversion functions, enabling compiler warnings for implicit narrowing conversions, and employing static analysis tools to detect potential truncation scenarios during the development lifecycle are essential strategies for mitigating this risk and maintaining application integrity.

MITRE CWE Description
Truncation errors occur when a primitive is cast to a primitive of a smaller size and data is lost in the conversion. 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. While this method may be employed viably to isolate the low bits of a value, this usage is rare, and truncation usually implies that an implementation error has occurred.
Common Consequences (1)
IntegrityModify Memory
The true value of the data is lost and corrupted data is used.
Mitigations (1)
ImplementationEnsure that no casts, implicit or explicit, take place that move from a larger size primitive or a smaller size primitive.
Examples (2)
This example, while not exploitable, shows the possible mangling of values associated with truncation errors:
int intPrimitive; short shortPrimitive; intPrimitive = (int)(~((int)0) ^ (1 << (sizeof(int)*8-1))); shortPrimitive = intPrimitive; printf("Int MAXINT: %d\nShort MAXINT: %d\n", intPrimitive, shortPrimitive);
Bad · C
Int MAXINT: 2147483647 Short MAXINT: -1
Result
In the following Java example, the method updateSalesForProduct is part of a business application class that updates the sales information for a particular product. The method receives as arguments the product ID and the integer amount sold. The product ID is used to retrieve the total product count from an inventory object which returns the count as an integer. Before calling the method of the sa…
... // update sales database for number of product sold with product ID public void updateSalesForProduct(String productID, int amountSold) { // get the total number of products in inventory database int productCount = inventory.getProductCount(productID); // convert integer values to short, the method for the // sales object requires the parameters to be of type short short count = (short) productCount; short sold = (short) amountSold; // update sales database for product sales.updateSalesCount(productID, count, sold); } ...
Bad · Java
... // update sales database for number of product sold with product ID public void updateSalesForProduct(String productID, int amountSold) { // get the total number of products in inventory database int productCount = inventory.getProductCount(productID); // make sure that integer numbers are not greater than // maximum value for type short before converting if ((productCount < Short.MAX_VALUE) && (amountSold < Short.MAX_VALUE)) { // convert integer values to short, the method for the // sales object requires the parameters to be of type short short count = (short) productCount; short sold = 
Good · Java
CVE IDTitleCVSSSeverityPublished
CVE-2026-44927 Uriparser 安全漏洞 — uriparser 2.9 Low2026-05-08
CVE-2026-42371 Uriparser 安全漏洞 — uriparser 5.1 Medium2026-04-27
CVE-2026-32240 Cap'n Proto: Integer overflow in KJ-HTTP chunk size — capnproto 8.2AIHighAI2026-03-12
CVE-2025-53723 Windows Hyper-V Elevation of Privilege Vulnerability — Windows 10 Version 1507 7.8 High2025-08-12
CVE-2025-6965 Integer Truncation on SQLite — SQLite 7.5 -2025-07-15
CVE-2025-49679 Windows Shell Elevation of Privilege Vulnerability — Windows 10 Version 1507 7.8 High2025-07-08
CVE-2024-49018 SQL Server Native Client Remote Code Execution Vulnerability — Microsoft SQL Server 2017 (GDR) 8.8 High2024-11-12
CVE-2024-43639 Windows KDC Proxy Remote Code Execution Vulnerability — Windows Server 2025 9.8 Critical2024-11-12
CVE-2024-43519 Microsoft WDAC OLE DB provider for SQL Server Remote Code Execution Vulnerability — Windows 10 Version 1809 8.8 High2024-10-08
CVE-2024-37337 Microsoft SQL Server Native Scoring Information Disclosure Vulnerability — Microsoft SQL Server 2017 (GDR) 7.1 High2024-09-10
CVE-2024-38125 Kernel Streaming WOW Thunk Service Driver Elevation of Privilege Vulnerability — Windows 10 Version 1809 7.8 High2024-08-13
CVE-2024-38044 DHCP Server Service Remote Code Execution Vulnerability — Windows Server 2019 7.2 High2024-07-09
CVE-2024-38086 Azure Kinect SDK Remote Code Execution Vulnerability — Azure Kinect SDK 6.4 Medium2024-07-09
CVE-2024-30029 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 7.5 High2024-05-14
CVE-2024-30024 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 7.5 High2024-05-14
CVE-2024-30023 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 7.5 High2024-05-14
CVE-2024-30022 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 7.5 High2024-05-14
CVE-2024-30014 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 7.5 High2024-05-14
CVE-2024-30015 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 7.5 High2024-05-14
CVE-2024-30009 Windows Routing and Remote Access Service (RRAS) Remote Code Execution Vulnerability — Windows 10 Version 1809 8.8 High2024-05-14
CVE-2023-32143 D-Link DAP-1360 webupg UPGCGI_CheckAuth Numeric Truncation Remote Code Execution Vulnerability — DAP-1360 8.8 -2024-05-03
CVE-2024-28944 Microsoft OLE DB Driver for SQL Server Remote Code Execution Vulnerability — Microsoft SQL Server 2019 (GDR) 8.8 High2024-04-09
CVE-2024-29050 Windows Cryptographic Services Remote Code Execution Vulnerability — Windows 10 Version 1809 8.4 High2024-04-09
CVE-2024-21440 Microsoft ODBC Driver Remote Code Execution Vulnerability — Windows 10 Version 1809 8.8 High2024-03-12
CVE-2024-21434 Microsoft Windows SCSI Class System File Elevation of Privilege Vulnerability — Windows 10 Version 1809 7.8 High2024-03-12
CVE-2024-21451 Microsoft ODBC Driver Remote Code Execution Vulnerability — Windows 10 Version 1809 8.8 High2024-03-12
CVE-2024-21429 Windows USB Hub Driver Remote Code Execution Vulnerability — Windows 10 Version 1809 6.8 Medium2024-03-12
CVE-2024-21391 Microsoft WDAC OLE DB provider for SQL Server Remote Code Execution Vulnerability — Windows 10 Version 1809 8.8 High2024-02-13
CVE-2024-21377 Windows DNS Information Disclosure Vulnerability — Windows 10 Version 1809 5.5 Medium2024-02-13
CVE-2024-21352 Microsoft WDAC OLE DB provider for SQL Server Remote Code Execution Vulnerability — Windows 10 Version 1809 8.8 High2024-02-13

Vulnerabilities classified as CWE-197 (数值截断错误) represent 39 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.