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 length check compared each character-string against the total record length but ignored the cumulative length of all strings plus separators and terminator.
Seen in 1 report
-
A length check macro does not validate that the length is non-negative and the return value of the bounded print is not checked.
Seen in 1 report
-
A length check was missing before reading the buffer in the whitespace check.
-
A length field from the input is copied into a fixed-size stack buffer without checking that it fits.
-
A length field from the NRW file was copied into a fixed-size heap buffer without verifying it fit.
-
A length field from the tag header was used as the copy bound without checking it against the destination buffer size.
-
A length field or data size from the file is copied into a fixed-size heap buffer without verifying it fits.
-
A length field uses zero both for not supplied and for explicitly zero, so the code falls back to strlen.
Seen in 1 report
-
A length is declared signed but parsed as unsigned, so negative values bypass the check and move the string pointer backwards.
Seen in 1 report
-
A length is subtracted from a maximum without checking, causing an underflow and an overly large length.
Seen in 1 report
-
A length or count decremented below zero and wrapped to a large value.
Seen in 1 report
-
A length or count value from the request is not validated, causing an integer overflow in the buffer size calculation.
-
A length or offset field in the file was trusted without checking it against the real buffer size.
-
A length or size value from the MKV file was used without a bounds check before a heap write.
-
A length plus one size calculation overflows when the length is the maximum unsigned 32-bit value, producing a tiny allocation.
Seen in 1 report
-
A length taken from the uploaded file is used in a copy into a fixed-size heap buffer without a bounds check.
-
A length taken from untrusted input is used directly in a bounded copy without checking it fits the destination.
Seen in 1 report
-
A length value from the file is used directly as an index into a fixed-size stack buffer without bounds checking.
Seen in 1 report
-
A length variable is decremented without checking for zero, causing an integer underflow used as a size argument.
Seen in 1 report
-
A length variable is set to minus one when the timezone pointer equals the fraction pointer and is later treated as no length given, causing a string read past the buffer.
Seen in 1 report
-
A length variable was decremented without checking it was already zero, so it became negative.
Seen in 1 report
-
A length was decremented without checking for zero, causing an underflow.
Seen in 1 report
-
A length-append helper writes into a buffer without checking the new length fits.
Seen in 1 report
-
A lifetime bug in dead-block removal or an assembly helper uses a stack object after its scope ends.
Seen in 1 report
-
A lifetime or ownership error in the raw-frame conversion pipeline wrote into stale or freed memory.
Seen in 1 report
-
A lifetime ordering issue: the connection and display are destroyed before the screen that holds a proxy pointer to them.
Seen in 1 report
-
$1,000 Medium
-
-
A live hash set of shadow instances was iterated without a snapshot and the modification check was compiled out in release builds.
Seen in 1 report
-
A local packet structure was used without being initialised, so garbage side-data fields were freed by the cleanup routine.
Seen in 1 report
-
A local service fails to validate user-supplied data, causing an out-of-bounds access.
-
A local variable is not initialised before being passed to a stream read, and the closed-stream case is not handled.
Seen in 1 report
-
A locking object's destructor touches memory after the underlying object has been freed because lifetime is not managed during stop.
Seen in 1 report
-
A logic error and out-of-bounds access in fragment descriptor handling plus a copy-before-check loop allow a heap overflow.
-
A logic flaw in the optimising compiler when compiling a class with a parent class and a new.target reference led to an out-of-bounds write.
Seen in 1 report
-
A logic mistake in DNS query buffer length calculation for an escaped trailing dot.
Seen in 1 report
-
A long value from the environment is cast to int without checking it fits, producing an oversized write.
Seen in 1 report
-
A lookup meant for the UI thread is called from the IO thread, guarded only by a debug assertion.
Seen in 1 report
-
$5,000 Medium
-
-
A loop condition checked the byte value before verifying the pointer was within bounds.
Seen in 1 report
-
A loop counter is decremented each iteration without checking it becomes negative, so the loop runs indefinitely and writes past the buffer.
Seen in 1 report
-
A loop in the gradient colour-table generator did not check the write position against the fixed buffer size.
-
A loop index is checked against the size of one table but then used to index a different table.
Seen in 1 report
-
A loop iterated the member container instead of a local copy, so erasing and reallocation during callbacks invalidated the iterators.
Seen in 1 report
-
A loop that frees the same pointer twice when an allocation fails after a successful iteration.
-
A lowering drops the safe-integer check bit so a checked consumer receives an unchecked truncation.
Seen in 1 report
-
A manually managed reference was released by two unconditional release calls in separate shutdown paths with no flag to release only once.
Seen in 1 report
-
A map entry was erased using an iterator after a call that could synchronously destroy the socket and erase that same entry, invalidating the iterator.
Seen in 1 report
-
$5,000 High
-
-
A map holds non-owning raw pointers and the cleanup callback takes the same lock as the open path, allowing a race.
Seen in 1 report
-
A map of raw pointers is read from a worker thread without a lock while the main thread deletes entries.
Seen in 1 report
-
A member flag was restored through a raw pointer held across a call that could synchronously destroy the owning object.
Seen in 1 report
-
A member observer list is iterated instead of a local copy, so shutdown during the loop frees it.
Seen in 1 report
-
A member was accessed by two threads without synchronisation and task ordering let the object be destroyed while in use.
Seen in 1 report