Skip to content

In-depth lesson · Memory corruption

Typical fixes

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 301 to 350 of 976
  1. Reject negative or oversized size fields and check arithmetic for overflow before using the result as a length.

    Seen in 3 reports
  2. Replace unbounded sprintf and strcat into fixed stack buffers with length-checked copies.

    Seen in 3 reports
  3. Reset global state and clean up partially initialised structures when a request aborts with an out-of-memory error.

    Seen in 3 reports
  4. Security update corrects how the kernel-mode driver handles objects in memory.

    Seen in 3 reports
  5. Security update corrects how the service handles objects in memory.

    Seen in 3 reports
  6. Security updates corrected how the affected components handle objects in memory.

    Seen in 3 reports
  7. Size buffers from the actual render quantum at runtime rather than a compile-time constant, and keep the bounds check in release builds.

    Seen in 3 reports
  8. Stop timers and clear handles during pre-finalisation, and root wrappers in the persistent map.

    Seen in 3 reports
  9. The length check should reject names and paths of exactly the maximum length, using greater-than-or-equal rather than greater-than.

    Seen in 3 reports
  10. The update corrected how the CLFS driver handles objects in memory.

    Seen in 3 reports
  11. Use bounded formatting instead of an unbounded formatted print when building error messages into fixed-size buffers.

    Seen in 3 reports
  12. Use checked 64-bit arithmetic for buffer size calculations and account for primitive restart expansion.

    Seen in 3 reports
  13. Use weak pointers and existence checks before dereferencing objects that callbacks or other threads may free.

    Seen in 3 reports
  14. Validate embedded font data before processing it in the font driver.

    Seen in 3 reports
  15. Validate image dimensions and component counts against the allocated buffer size before decoding.

    Seen in 3 reports
  16. Validate indices and sizes in IPC deserialisers against the accompanying lists and buffers before use.

    Seen in 3 reports
  17. Validate length and offset fields from the file before using them to read from or write to a buffer.

    Seen in 3 reports
  18. Validate numeric values used in size calculations before allocation to prevent overflow and underflow.

    Seen in 3 reports
  19. Validate pointer types and size arithmetic in kernel drivers.

    Seen in 3 reports
  20. Validate pointers and references supplied by low-privileged callers before dereferencing or releasing them.

    Seen in 3 reports
  21. Validate pointers before dereferencing them.

    Seen in 3 reports
  22. Validate request lengths and sizes before copying, and hold references to objects until packet handling completes.

    Seen in 3 reports
  23. Validate that a file-supplied value points to valid memory before dereferencing it.

    Seen in 3 reports
  24. Validate that a pointer taken from untrusted input points to trusted memory before dereferencing it, and check for null before use.

    Seen in 3 reports
  25. Validate the length of DNS name data and error codes before copying into fixed-size buffers.

    Seen in 3 reports
  26. Validate the length of user-supplied buffers before copying data into them.

    Seen in 3 reports
  27. Validate the length of user-supplied data before writing it into a fixed-size buffer.

    Seen in 3 reports
  28. Validate the type of parsed data before casting or using it.

    Seen in 3 reports
  29. Validate the type of structures read from project files before using them.

    Seen in 3 reports
  30. Validate user-supplied lengths and counts before copying or allocating, and check object existence before use.

    Seen in 3 reports
  31. Validate user-supplied values before arithmetic and check for overflow and underflow before memory writes.

    Seen in 3 reports
  32. Validate user-supplied values before dereferencing them as pointers.

    Seen in 3 reports
  33. Wait for pending GPU work before releasing resources, and do not skip synchronisation on error paths.

    Seen in 3 reports
  34. Add bounds validation when parsing annotation objects.

    Seen in 2 reports
  35. Apply the same script-length limit on the eager Baseline path and fail rather than truncate when offsets exceed the bitfield width.

    Seen in 2 reports
  36. Bound formatted output and Content-Length handling in the MXIT protocol.

    Seen in 2 reports
  37. Bound the attribute loop by the response buffer size rather than the requested count.

    Seen in 2 reports
  38. Cancel delayed tasks and weak-bind callbacks so they cannot run after the owning object is destroyed.

    Seen in 2 reports
  39. Carry the argument-mode flag into the sizing pass so both passes agree on escaping.

    Seen in 2 reports
  40. Change how RTF content and document objects are parsed and validated.

    Seen in 2 reports
  41. Check certificate and response sizes before copying into fixed heap buffers and guard against use after free during connection handling.

    Seen in 2 reports
  42. Check for integer overflow and confirm the new size is large enough before doubling a buffer.

    Seen in 2 reports
  43. Check length and count values for underflow and wraparound before using them.

    Seen in 2 reports
  44. Check stride and offset values against an upper bound and the actual allocation size.

    Seen in 2 reports
  45. Check that a Collab object still exists before operating on it.

    Seen in 2 reports
  46. Check that indices read from the file are within the valid range before using them.

    Seen in 2 reports
  47. Check the length before copying file-supplied data into a fixed-length heap buffer.

    Seen in 2 reports
  48. Check the result of map insertions and only store pointers to objects that were successfully inserted.

    Seen in 2 reports
  49. Check the return value of reads and recursive calls before using or freeing the result.

    Seen in 2 reports
  50. Clamp parser output to the specification's maximum values before passing it to hardware drivers.

    Seen in 2 reports