In-depth lesson · Memory corruption
Root causes
Every point the Memory corruption reports back under this heading, best-backed first, each with the reports it is seen in.
-
A memory resource is used before it has been initialised, letting crafted input steer writes or leak data.
Seen in 8 reports
-
A resource is accessed using an incompatible type, causing type confusion and memory corruption.
Seen in 8 reports
-
Unsafe integer arithmetic such as overflow, underflow, wraparound and truncation of size or length values is a root cause.
Seen in 8 reports
-
Database and JSON field values copied into fixed-size stack buffers with strcpy, strncpy, memcpy or sprintf without a length check.
Seen in 8 reports
-
Insufficient input validation or bounds checking when parsing media files.
Seen in 8 reports
-
Integer overflow, underflow or wraparound not handled safely before use.
Seen in 8 reports
-
Kernel components mishandle object lifetimes or pointers, allowing a crafted local application to corrupt memory.
Seen in 8 reports
-
Numeric truncation, integer overflow or underflow is not handled safely before a size calculation or memory write.
Seen in 8 reports
-
Objects are freed and then referenced again while processing crafted documents.
Seen in 8 reports
-
Objects are freed while still referenced, often because a synchronous callback or nested loop destroys the owner mid-operation.
Seen in 8 reports
-
PDF editor object handling uses objects after they are freed because their existence is not checked before use.
Seen in 8 reports
-
PDF form fields use objects after they are freed without checking they still existed.
Seen in 8 reports
-
File format parsers trust size or length fields in the file and copy or read data without checking it fits the destination or source buffer.
Seen in 8 reports
-
Size and offset values from files are used in arithmetic without overflow or underflow checks, so allocations are too small or checks wrap around.
Seen in 8 reports
-
Size calculations overflow, underflow or truncate before allocation.
Seen in 8 reports
-
The parser copies user-supplied data into a fixed-size buffer without checking the supplied length first.
Seen in 8 reports
-
The scripting engine mishandled objects in memory, leading to memory corruption.
Seen in 8 reports
-
The software does not check the length or size of data read from DPA files before copying it into a fixed-size buffer.
Seen in 8 reports
-
The webproc CGI handler copies request parameters into fixed-length buffers without checking their length.
Seen in 8 reports
-
Use-after-free where an object is freed while still reachable or reused.
Seen in 8 reports
-
User-controlled strings are copied into fixed-size buffers with functions that do not take a length limit.
Seen in 8 reports
-
A recurring mistake is copying a user-controlled length into a fixed-size buffer without checking that it fits.
Seen in 7 reports
-
A resource is accessed using an incompatible type, or a value from a file is used as a pointer without validation.
Seen in 7 reports
-
A user-supplied index or length was used to access an array or buffer without validating it against the real size.
Seen in 7 reports
-
An object is used after being freed, exploitable through a race condition.
Seen in 7 reports
-
Callbacks invoked during a method could synchronously destroy the object, and the code kept using its members afterwards.
Seen in 7 reports
-
Code frees an object and later uses a pointer to it without checking that it still exists.
Seen in 7 reports
-
Data is copied into a fixed-size stack buffer without a length check.
Seen in 7 reports
-
Data size is not checked before copying into a heap buffer.
Seen in 7 reports
-
Double free where the same memory is released more than once.
Seen in 7 reports
-
Input lengths or sizes are not checked before copying into fixed-size heap or stack buffers.
Seen in 7 reports
-
Integer overflow, underflow or wraparound in size and offset calculations used unsafely.
Seen in 7 reports
-
Length and size fields in file and network formats were trusted without bounds checks, leading to overflows.
Seen in 7 reports
-
Length or offset values read from the file used without checking them against the allocated buffer size.
Seen in 7 reports
-
Length, size or offset values from input are trusted without checking them against the destination buffer.
Seen in 7 reports
-
Lengths, offsets and element counts from files are trusted, causing reads before or past buffers.
Seen in 7 reports
-
Reading data in a USB driver lacks a bounds check.
Seen in 7 reports
-
Packet capture parsers lack bounds checks before reading fields from packet buffers.
Seen in 7 reports
-
Missing bounds checks when reading data allow reads past the end of a buffer.
Seen in 7 reports
-
Several drawing routines of the display driver lack NULL checks before dereferencing pointers.
Seen in 7 reports
-
Network or file input is copied into a fixed-size stack buffer without bounds checking.
Seen in 7 reports
-
The cycle collector frees objects while they are still referenced elsewhere, giving use-after-free.
Seen in 7 reports
-
File format parsers copy user-supplied lengths into fixed-size stack buffers without checking the length first.
Seen in 7 reports
-
Parsers read or write past allocated buffers because the size and structure of file data are not validated.
Seen in 7 reports
-
File format parsers trust size or length fields in the file without checking them against the allocated buffer.
Seen in 7 reports
-
File format parsers trust size or offset fields in the file without checking them against the actual buffer size.
Seen in 7 reports
-
File format parsers trusted length or offset values from the file without comparing them to the real buffer size.
Seen in 7 reports
-
CAD file parsers use objects after freeing them because they do not check that the object still exists.
Seen in 7 reports
-
Router tmpServer handlers trust payload lengths and TLV counts and use them in copies into fixed buffers without bounds checks.
Seen in 7 reports
-
Size or offset fields in files are trusted without checking them against the real buffer length.
Seen in 7 reports