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.
-
The stride calculation can produce a negative value that is used as a size argument without validation.
Seen in 1 report
-
The stride calculation returns zero on integer overflow, bypassing the size check, and 32-bit pitch and row count values overflow further.
Seen in 1 report
-
The stride times height multiplication overflowed, so the buffer was allocated smaller than the data later written into it.
Seen in 1 report
-
The strip count is recomputed instead of using the stored value, which is wrong in strip chop mode where the stored count is modified.
Seen in 1 report
-
The struct uses a pointer array instead of a flexible array, so the allocated space is too small for the string being copied.
-
The structured clone implementation mishandles the data tag of a transferred object so the expected alloc or mapped tag invariant does not hold.
-
The style context is freed by a resize while still referenced during innerText reading.
Seen in 1 report
-
The subscription handler writes each requested quality-of-service byte into a fixed 512-byte stack array and increments the index without a bounds check.
Seen in 1 report
-
The substitution code failed to refresh its saved pointers after the line buffer was reallocated, and buffer sizes were held in signed ints that overflow at large sizes.
Seen in 1 report
-
The suggested YCbCr model field is not bounds checked during deserialisation and bit-packing, so an oversized value corrupts an adjacent field.
Seen in 1 report
-
The sum of current length and appended count can overflow, leading to an undersized allocation and out-of-bounds writes.
Seen in 1 report
-
The sum of three unsigned 32-bit header lengths wraps before being stored in a signed int, so the buffer is undersized.
Seen in 1 report
-
The sum of two 32-bit fields overflows before being widened to 64 bits, producing a small block size.
Seen in 1 report
-
The sum of two 32-bit integers overflowed before the bounds check, allowing an out-of-bounds read.
Seen in 1 report
-
The Swift reader disabled secure coding and decoded the archive without an allowlist of permitted classes, unlike the hardened Objective-C counterpart.
Seen in 1 report
-
The sync loop iterated a by-value snapshot of dirty bits, so a reentrant dirty bit set during texture respecification was ignored and a stale cache entry was dereferenced.
Seen in 1 report
-
The tag length was subtracted from the input length without first checking the input was at least as long as the tag.
-
The target location is cached before the right-hand side is evaluated, so side effects are not reflected in the final store.
Seen in 1 report
-
The target parameter is URL-decoded without a length check, leading to a stack buffer overflow.
-
The TCP/IP driver failed to validate the size or type of IPv6 extension headers within IPSec ESP packets.
Seen in 1 report
-
The terminate method copies the renderer member to a local but never clears the member, so a strong reference survives and destruction happens on the wrong thread.
Seen in 1 report
-
The texImage2D implementation did not validate the supplied width and height against UNPACK_IMAGE_HEIGHT, so the depth texture initialisation shader accessed memory outside the pixel unpack buffer.
Seen in 1 report
-
The text control's editor state is freed by cycle collection while a pending selection command still holds a reference to it.
Seen in 1 report
-
The texture format cache was updated for texImage2D levels that had no native storage, leaving the cached format out of step with the real Metal texture layout.
Seen in 1 report
-
The texture-image state sync list omitted the pack-state dirty bits, so a previously synced pack row length was not reset before the CPU readback.
Seen in 1 report
-
$90,000 Critical
-
-
The throttle calls a page close synchronously during navigation, destroying itself, then continues to use its own pointer.
Seen in 1 report
-
The tier-up runtime function used the signature from the importing module rather than the module that owns the function table.
Seen in 1 report
-
The TIF parser fails to validate a user-supplied size or count, leading to an integer overflow before a memory write.
-
The tile list parsing code does not check the input length before copying it into a fixed-size stack buffer.
-
The tile memory fallback clears the flag without removing the image from the context tracking list, leaving a dangling pointer.
Seen in 1 report
-
The timeline's fence list does not increment the reference count of the fence objects it holds, so a fence can be freed while still on the list.
-
The timeout handler erased entries and freed their nodes before running error callbacks that synchronously finished other requests.
Seen in 1 report
-
The timeout timer swapped the request timeout set into a local set and back, so an entry inserted by a re-entrant callback stayed only in the local set and was freed when it went out of scope.
Seen in 1 report
-
$43,000 Critical
-
-
The title padding uses a bounded copy with the input length instead of the destination size.
Seen in 1 report
-
The token scan loop only stops at whitespace so a line with no whitespace runs past the buffer and writes a terminator out of bounds.
Seen in 1 report
-
The tooltip removal cleared the owner pointer but not the cached user-data pointer, leaving it dangling after the platform tooltip struct was freed.
Seen in 1 report
-
The Torque rewrites of the fixed-array allocation builtins dropped the maximum length bounds check the original assembly version performed.
Seen in 1 report
-
The total length is computed as size times count without checking for integer overflow before allocation.
Seen in 1 report
-
The total length was computed as the delimiter length times the element count minus one plus the element lengths, with no overflow check before allocation.
-
The total size is validated only for the first fragment; later fragments trust the size field from the packet header.
Seen in 1 report
-
The touch event handler does not check whether the widget was destroyed during synchronous event dispatch.
Seen in 1 report
-
The trailer ID string is decoded into a fixed-size heap buffer with no length check.
Seen in 1 report
-
The transfer-shrink copy path allocated the destination uninitialised and copied only the prefix, while the resize growth path assumed the tail was already zeroed.
Seen in 1 report
-
The translate agent does not check whether it was destroyed after returning from synchronous JavaScript execution.
Seen in 1 report
-
The tree is not reset after a failed unserialize, so a duplicate node ID insertion returns a dangling pointer.
Seen in 1 report
-
The trustlet passes caller-supplied source pointer, destination pointer and length straight to memcpy instead of copying a fixed error code.
Seen in 1 report
-
The two gamma values were not checked to have the same sign, causing an integer overflow and out-of-bounds write.
Seen in 1 report
-
The two metadata parsing passes disagreed: the first skipped reserving a slot but the second still advanced the cursor, so later chunks wrote into an out-of-bounds slot.
Seen in 1 report
-
The type check in the division workaround transform matched only scalar types, so vector division and modulo were emitted without the workaround.
Seen in 1 report
-
The typed optimisation reducer creates a merge snapshot containing an uninhabited type, so an earlier fix did not cover every path.
Seen in 1 report
-
$7,000 High
-