Integer overflow
An arithmetic result exceeds the range of its integer type and wraps around or is truncated (CWE-190). In size calculations it leads to undersized allocations and then buffer overflows; check arithmetic before allocating or use checked operations.
- Also called
- integer wraparound
- Defined in
- MITRE CWE-190
- Identifiers
- CWE-190: Integer overflow or wraparound
Covered in
Find, fix and contain memory-safety bugs in C and C++
Recognize out-of-bounds access, use after free, NULL dereference and integer overflow in C and C++, fix them with checked lengths and single ownership, harden release builds, catch the rest with sanitizers and fuzzing, and plan new code in a memory-safe language.
Audit unsafe Rust, FFI boundaries and crate dependencies
Know what the Rust compiler proves and what it leaves to you: review unsafe code for soundness, wrap foreign calls in small safe functions, decide how overflow and panics behave in release builds, gate crates with RustSec, and replace C one boundary at a time.