A heap overflow is a memory corruption bug that occurs when a program writes past the end of a buffer on the heap, the part of memory used for dynamic allocations. Because heap objects often sit next to other live data, an overflow can overwrite adjacent pointers, size fields, or application state, leading to crashes, data corruption, information leaks, or code execution.
In cyber security, heap overflows matter because they commonly appear in parsers and file handlers that process attacker-controlled input, such as image libraries, document viewers, and network services. A crafted file may push a C routine into copying too much data or miscalculating lengths, which is why image checks and metadata routines deserve the same scrutiny as more obvious attack surfaces. Defenders reduce risk by patching vulnerable software, compiling with memory-safety hardening, using ASLR and other mitigations, and treating untrusted binary formats as hostile input rather than simple validation data.


