This vulnerability occurs when an application accepts user input meant to define a quantity—like a number, size, or count—but fails to properly check if that value is safe and reasonable before using it.
Applications constantly handle user-defined quantities: file sizes to upload, lengths for arrays, loop iteration counts, or prices for transactions. If your code trusts these numbers without scrutiny, it can be tricked into performing dangerous actions. Attackers exploit this by submitting extreme or malicious values—like a negative number, an impossibly large size, or zero—to manipulate the program's logic, crash it, or force it into an unstable state. Failing to validate quantities has direct consequences. Your application might allocate all available memory based on a huge size, perform a calculation that leads to an integer overflow, or enter an infinite loop. This opens the door to denial-of-service, buffer overflows, or logic flaws that compromise security. Always treat any user-supplied quantity as untrusted and enforce strict rules for minimums, maximums, and expected ranges before the value is used in any operation.
Impact: Varies by Context
Since quantities are used so often to affect resource allocation or process financial data, they are often present in many places in the code.
Strategy: Input Validation
Effectiveness: High
javac
/* board dimensions /
c