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 151 to 200 of 976
  1. Validate size and offset fields against the actual buffer length before reading or writing.

    Seen in 6 reports
  2. Validate size, length and structure fields in the file before using them.

    Seen in 6 reports
  3. Validate that enough bytes remain in the packet buffer before reading a field.

    Seen in 6 reports
  4. Validate user-supplied pointers and sizes before use, including overflow checks on size arithmetic.

    Seen in 6 reports
  5. Add bounds checks before reading or writing parsed data.

    Seen in 5 reports
  6. Check data length before copying into heap or stack buffers and reject oversized input.

    Seen in 5 reports
  7. Check for overflow and underflow when computing buffer sizes and indices, and use unsigned or checked arithmetic.

    Seen in 5 reports
  8. Check for overflow before adding or multiplying size values, and initialise memory before use.

    Seen in 5 reports
  9. Check for overflow before using untrusted sizes in allocation or loop arithmetic.

    Seen in 5 reports
  10. Check size and offset values from the file against the actual allocated buffer before reading or writing.

    Seen in 5 reports
  11. Check that a length or offset read from a file stays within the allocated buffer before reading.

    Seen in 5 reports
  12. Check that an annotation object still exists before operating on it.

    Seen in 5 reports
  13. Check that an object still exists before using it, and do not free a structure while another component still holds a pointer to it.

    Seen in 5 reports
  14. Check that an object still exists before using or freeing it, and guard against double free.

    Seen in 5 reports
  15. Check that the size used for allocation matches the size used for writing.

    Seen in 5 reports
  16. Clear pointers after freeing and check object validity before every use.

    Seen in 5 reports
  17. Confirm an object still exists before using it, and keep references alive across callbacks.

    Seen in 5 reports
  18. Correct how the subsystem handles objects in memory to remove the integer overflow.

    Seen in 5 reports
  19. Correct type handling and buffer sizing in Ruby extension bindings.

    Seen in 5 reports
  20. Do not dereference user-supplied values as pointers without validating that they refer to valid memory.

    Seen in 5 reports
  21. Fix object lifetime handling so freed objects are not reused, and validate pointers received from untrusted callers.

    Seen in 5 reports
  22. Handle integer overflow, underflow and wraparound safely.

    Seen in 5 reports
  23. Hold a weak reference or otherwise ensure object lifetime before using a captured pointer in an asynchronous completion handler.

    Seen in 5 reports
  24. Hold strong references or cancel pending callbacks when the owning object is torn down.

    Seen in 5 reports
  25. Hold strong references or use weak pointers across callbacks that can destroy the object.

    Seen in 5 reports
  26. Initialise memory and pointers before use.

    Seen in 5 reports
  27. Initialise pointers before dereferencing them.

    Seen in 5 reports
  28. Security update corrects how the kernel handles objects in memory.

    Seen in 5 reports
  29. Use overflow-safe arithmetic when computing allocation sizes from file or client data.

    Seen in 5 reports
  30. Validate client-supplied indices and lengths before using them to access arrays or copy into buffers.

    Seen in 5 reports
  31. Validate input types before buffer allocation and zero-fill allocated buffers.

    Seen in 5 reports
  32. Validate length and size fields from files against the destination buffer before copying.

    Seen in 5 reports
  33. Validate length and size fields from the file against the destination buffer capacity before copying, and check indices against table bounds.

    Seen in 5 reports
  34. Validate length, offset and type fields from the file before using them to read or write memory.

    Seen in 5 reports
  35. Validate length, size and offset fields from files and network packets against the destination buffer before copying, and check array indexes against bounds.

    Seen in 5 reports
  36. Validate pointers and object types before dereferencing or casting them.

    Seen in 5 reports
  37. Validate pointers before dereferencing or releasing them.

    Seen in 5 reports
  38. Validate size conversions between integer widths so a large size cannot become negative or underflow.

    Seen in 5 reports
  39. Validate that pointers come from a trusted source before dereferencing them.

    Seen in 5 reports
  40. Validate the size and bounds of user input in IOCTL handlers before any memory operation.

    Seen in 5 reports
  41. Validate the size of user-supplied data before using it to allocate a buffer.

    Seen in 5 reports
  42. Vendor fixed these with improved memory management and improved input validation.

    Seen in 5 reports
  43. Add bounds checks before writing to heap and stack buffers and validate numeric fields before size calculations.

    Seen in 4 reports
  44. Add proper bounds checks and input validation before memory access or allocation.

    Seen in 4 reports
  45. Bound the length of HTTP header values before copying them into fixed buffers.

    Seen in 4 reports
  46. Bounds-check indices taken from user data before using them to access arrays.

    Seen in 4 reports
  47. Check allocation size calculations for integer overflow before allocating and copying.

    Seen in 4 reports
  48. Check arithmetic on size and count values before use to prevent wraparound.

    Seen in 4 reports
  49. Check arithmetic on sizes and lengths for overflow and wraparound before using the result.

    Seen in 4 reports
  50. Check arithmetic on sizes and types so underflow, overflow and bad conversions cannot corrupt memory.

    Seen in 4 reports