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 51 to 100 of 976
  1. Check the length of user-supplied data against the destination buffer before copying.

    Seen in 14 reports
  2. Validate the size and content of user-supplied data before copying it into fixed-size buffers or using it as a pointer.

    Seen in 14 reports
  3. Add bounds checks before writing input into heap buffers.

    Seen in 13 reports
  4. Check the length of user-supplied data before copying it into a fixed-size buffer.

    Seen in 13 reports
  5. Correct how kernel-mode drivers handle objects in memory.

    Seen in 13 reports
  6. Correct object lifetime handling so freed memory is not reused or freed twice.

    Seen in 13 reports
  7. Validate size and length fields from files against the destination buffer before copying or reading, and add bounds checks in parsers.

    Seen in 13 reports
  8. Check that an object still exists before using it, and clear queued callbacks when the owner is freed.

    Seen in 12 reports
  9. Reject values that would overflow, underflow or wrap before using them in size calculations.

    Seen in 12 reports
  10. Add bounds checks on lengths and offsets taken from user-supplied files before copying or reading.

    Seen in 11 reports
  11. Check that an object still exists before using it, and re-check weak pointers after calls that can destroy the object.

    Seen in 11 reports
  12. Correct how the engine handles objects in memory when parsing crafted files.

    Seen in 11 reports
  13. Correct object handling in Office document parsing, including the Preview Pane path.

    Seen in 11 reports
  14. Correct object lifetime and validation in kernel-mode drivers.

    Seen in 11 reports
  15. Validate input lengths against the destination buffer size before copying or reading.

    Seen in 11 reports
  16. Validate that a user-supplied value is a valid pointer before dereferencing it.

    Seen in 11 reports
  17. Validate the size and type of data read from files before using it or writing it to buffers.

    Seen in 11 reports
  18. Check declared lengths against the destination buffer size before every copy in packet and file parsers.

    Seen in 10 reports
  19. Check size calculations for overflow and sign-extension before allocating or indexing.

    Seen in 10 reports
  20. Improved bounds checking, improved state handling, improved memory management, and adopting 64-bit timestamps in the kernel.

    Seen in 10 reports
  21. Improved memory handling and memory management.

    Seen in 10 reports
  22. Initialise pointers and zero allocated arrays before use, especially on error paths.

    Seen in 10 reports
  23. Validate all file-supplied lengths and counts against the actual buffer sizes and check allocation arithmetic for overflow before allocating.

    Seen in 10 reports
  24. Check that an object still exists before operating on it, and correct object handling in the affected component.

    Seen in 9 reports
  25. Fix object lifetime handling so freed memory is not referenced, and close race windows.

    Seen in 9 reports
  26. Improve memory handling and management in the affected parser.

    Seen in 9 reports
  27. Keep objects alive across asynchronous callbacks or re-check references after event loop re-entry.

    Seen in 9 reports
  28. Manage object lifetimes so freed memory is not referenced again, including under concurrent teardown.

    Seen in 9 reports
  29. Validate caller-supplied pointers and initialise pointers before use.

    Seen in 9 reports
  30. Validate declared lengths against the destination buffer before copying, and check dimensions for overflow before allocating.

    Seen in 9 reports
  31. Validate every length, size and index read from the file against the destination buffer before copying or indexing.

    Seen in 9 reports
  32. Validate input length before copying into fixed-size heap or stack buffers.

    Seen in 9 reports
  33. Validate length and size fields from a file against the destination buffer before copying or writing.

    Seen in 9 reports
  34. Validate lengths and sizes from untrusted input before copying or allocating.

    Seen in 9 reports
  35. Validate size and count values and use checked arithmetic for allocation calculations.

    Seen in 9 reports
  36. Validate size and length values from image files against the allocated buffer before copying or writing.

    Seen in 9 reports
  37. Validate the size, length and structure of every field read from a file before copying or writing it to a buffer.

    Seen in 9 reports
  38. Validate the type of user-supplied data before using it in command handlers.

    Seen in 9 reports
  39. Bound every copy by the destination buffer size and check TLV counts and offsets before use.

    Seen in 8 reports
  40. Check integer arithmetic for overflow and wraparound before using the result as a size.

    Seen in 8 reports
  41. Check integer arithmetic for overflow, underflow and truncation before the resulting value is used as a size or index.

    Seen in 8 reports
  42. Check integer calculations for overflow, underflow and wraparound before using the result as a size or index.

    Seen in 8 reports
  43. Check that an object still exists before using it, and invalidate or reference-count handles that outlive the internal list they point into.

    Seen in 8 reports
  44. Check user-supplied lengths and counts against the destination buffer size before copying or looping.

    Seen in 8 reports
  45. Correct memory management so objects are not used after being freed.

    Seen in 8 reports
  46. Perform size arithmetic with overflow and underflow checks before comparing against limits or allocating buffers.

    Seen in 8 reports
  47. Use bounded copies and pass the destination buffer size to configuration retrieval functions.

    Seen in 8 reports
  48. Use weak pointers or liveness checks around calls that can synchronously destroy an object through callbacks or nested loops.

    Seen in 8 reports
  49. Validate every file-supplied length and size against the destination buffer before copying or reading.

    Seen in 8 reports
  50. Validate lengths and indices against the actual allocated size before copying or indexing, not against global limits.

    Seen in 8 reports