Skip to content

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.

Back to the lesson 2,701 to 2,750 of 3,817
  1. The code operates on a rendition object without checking that it still exists.

    Seen in 1 report
  2. The code passes the would-have-written length from a bounded string formatting call to the response sender instead of the actual truncated length.

    Seen in 1 report
  3. The code reads a length value from the file and uses it to loop without checking that it does not exceed the size of the allocated vector.

    Seen in 1 report
  4. The code reads a size value from the file and uses it to allocate a buffer, but then reads another size value and uses that to read data into the buffer without checking if it exceeds the allocated size.

    Seen in 1 report
  5. The code relied on a debug-only assertion for a map lookup and then unconditionally erased the entry.

    Seen in 1 report
  6. The code relied only on a debug assertion before dereferencing a map iterator, and the check was compiled out in release builds.

    Seen in 1 report
  7. The code reserves a vector using an index but then accesses that same index, reserving one slot too few and writing past the bitmap.

    Seen in 1 report
  8. The code restored always-on-top after a synchronous platform fullscreen call that can spin a nested message loop and delete the window, with no liveness check.

    Seen in 1 report
  9. The code returns success without initialising a buffer pointer when the input length is zero.

    Seen in 1 report
  10. The code saves a reference to the current node's path before iterating over references, but processing those references can change or free the node, leaving the saved reference dangling and later reused.

    Seen in 1 report
  11. The code scans a length-prefixed wide string for a null terminator, so the scan runs past the allocation.

    Seen in 1 report
  12. The code started receiving before sending pending data, so a connection drop could delete the object while it still accessed a member variable.

    Seen in 1 report
  13. The code stored raw pointers to channels instead of reference-counted pointers, so a synchronous failure during transport setup could free a channel that was then used again.

    Seen in 1 report
  14. The code that counted array elements left out the tail element, so the buffer was one element too small.

    Seen in 1 report
  15. The code treats any non-zero parse return as success instead of requiring both fields, leaving part of the output buffer uninitialised.

    Seen in 1 report
  16. The code treats the asynchronous cancel call as complete and frees the request and its overlapped structure before the kernel finishes.

    Seen in 1 report
  17. The code truncates the total size to a maximum but fails to adjust the copy length, so a large offset writes beyond the allocated buffer.

    Seen in 1 report
  18. The code unconditionally requested a renderable image format instead of checking the requested usage flags, and the size check was only an assertion.

    Seen in 1 report
  19. The code updates a hash index on a value without checking that it is an array.

    Seen in 1 report
  20. The code used an array access macro on a property without verifying it was actually an array.

    Seen in 1 report
  21. The code used the statement-handle error-clearing macro on a descriptor handle, applying a statement layout to a smaller descriptor object.

    Seen in 1 report
  22. The code uses a 32-bit path index from the SPECS section as an array index without validating it against the size of the path vector.

    Seen in 1 report
  23. The code uses a Text object without checking it still exists.

    Seen in 1 report
  24. The code uses sprintf to append hex-formatted bytes to a fixed-size stack buffer without checking the total output length.

    Seen in 1 report
  25. The code uses strcpy into fixed-size buffers without verifying the source fits, relying on callers to supply short values.

    Seen in 1 report
  26. The code uses the length of the ISAPI DLL's filesystem path to index into a string supplied by the DLL, which may be shorter, instead of using that string's own length.

    Seen in 1 report
  27. The code uses the source length instead of the destination buffer size when copying an IPv6 address string.

    Seen in 1 report
  28. The colour argument was only checked to be non-negative, not bounded to the valid range for palette images.

    Seen in 1 report
  29. The colour conversion page function did not validate the type of the object passed to it.

    Seen in 1 report
  30. The colour record count is not validated against the maximum index plus palette entries, so the buffer size calculation is smaller than the data later read.

    Seen in 1 report
  31. The column index read from the file is not checked against an upper limit before being used to calculate a write size.

    Seen in 1 report
  32. The comma operator's parse step never rejected opaque-type operands and the monomorphisation helper walked the left operand instead of the right, so the function was never specialised.

    Seen in 1 report
  33. The comma operator's parser routine never rejected opaque types or structs containing samplers, unlike the ternary operator.

    Seen in 1 report
  34. The command buffer was allocated using an attacker-supplied length field but then filled with a null-terminated string copy, so a short declared length undersized the buffer.

    Seen in 1 report
  35. The command check did not validate the size of user-supplied data, allowing an integer overflow.

    Seen in 1 report
  36. The command decoder did not reject linking while a program was active for transform feedback and trusted a stale link status instead of checking for an error.

    Seen in 1 report
  37. The command decoder treated a zero shared memory id as a raw pointer offset and ANGLE skipped size checks when the image size was negative one.

    Seen in 1 report
  38. The communication object is deleted when its frame is destroyed, but the loop over injected scripts keeps using it without a check.

    Seen in 1 report
  39. The comparison between request path and cookie path miscalculates lengths and reads past the allocated heap buffer.

    Seen in 1 report
  40. The comparison loop assumed the length was a multiple of four but validation did not enforce alignment.

    Seen in 1 report
  41. The compiled native implementation of string slicing disagreed with its logical definition at extreme positions, allowing a contradiction to be derived.

    Seen in 1 report
  42. The compiler generates incorrect code for certain combinations of C++ constructs.

    Seen in 1 report
  43. The compiler omitted a nil-pointer check when accessing a field through an embedded pointer that is the first element of a struct.

    Seen in 1 report
  44. The compiler's graph traversal for phi nodes did not reset its state between calls, so a cyclic graph could wrongly mark a node as having zero upper bits.

    Seen in 1 report
  45. The completion handler captured a raw pointer to the queue instead of a reference-counted smart pointer.

    Seen in 1 report
  46. The component count is not validated as non-zero before buffer allocation, and release builds omit the assert.

    Seen in 1 report
  47. The composite glyph loader does not reserve space for all points of the composite glyph, so a hinting instruction writes past the buffer.

    Seen in 1 report
  48. The compressed texture size calculation failed to multiply by the depth parameter for several formats, unlike the correct logic used for other formats.

    Seen in 1 report
  49. The compute shader's maximum index parameter was set to the full buffer size instead of the size of the data after the draw offset.

    Seen in 1 report
  50. The configuration-change check compared only frame size, profile, bit depth and colour space, ignoring other sequence header fields that affect buffer allocation.

    Seen in 1 report