User:Xochipilli/Integer Overflow Vulnerability
- Main article: Bitwise_math#Overflows
An integer overflow or underflow occurs when an integer exceeds its bounds (MIN_INT and MAX_INT for signed integers).
Integer overflow is expected behavior, however, it can lead to exploitation in certain circumstances. For example, an integer may be casted to a smaller type after the application validates it. If that integer is then used to allocate or copy memory, it could lead to a Buffer Overflow or Denial of Service (DoS) attack. Consider the following trivial example: