A numeric truncation error happens when a program converts a number to a smaller data type, cutting off its higher-order bits and corrupting the original value.
This vulnerability occurs because converting a larger integer (like a 32-bit `int`) to a smaller one (like a 16-bit `short`) doesn't raise an error—it silently discards the most significant bits. The resulting truncated value is often completely different from what the developer intended. This corrupted data can then cause critical failures if it's used as a buffer index, a loop counter, or a piece of application state, putting the system into an unpredictable and dangerous condition. While bitmasking to intentionally isolate low bits is a valid technique, unintentional truncation is almost always a coding bug. These errors can be subtle and spread across large codebases. Managing this at scale is difficult; an ASPM like Plexicus can help you track and remediate these flaws across your entire stack by correlating SAST findings with runtime data and suggesting precise fixes.
Impact: Modify Memory
The true value of the data is lost and corrupted data is used.
cbashjava
// update sales database for number of product sold with product ID* public void updateSalesForProduct(String productID, int amountSold) { ```
javajava
// update sales database for number of product sold with product ID* public void updateSalesForProduct(String productID, int amountSold) { ```
java
// convert integer values to short, the method for the*
java
Low