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 351 to 400 of 976
  1. Clear and null structures freed during proxy CONNECT handling so later code does not reference them.

    Seen in 2 reports
  2. Clear callbacks and per-buffer state during device destruction before the underlying memory is freed.

    Seen in 2 reports
  3. Clear handler references when the context is garbage collected, not only on destruction, and lock handler list access between threads.

    Seen in 2 reports
  4. Clear native pointers in Java bridge objects when the C++ object is destroyed, and remove observers at the same time.

    Seen in 2 reports
  5. Consume the data marker even when the declared size is zero, and reject oversized length fields before allocation.

    Seen in 2 reports
  6. Copy or pin the container before iterating, or re-check the iterator after any call that can run script or callbacks.

    Seen in 2 reports
  7. Correct object handling in the Windows PDF library.

    Seen in 2 reports
  8. Correct object lifetime in animation timing updates and keyframe property reads.

    Seen in 2 reports
  9. Correct the bounds check in tiled region rectangle insertion.

    Seen in 2 reports
  10. Correct the garbage collection algorithm so unserialize cannot free an object still in use.

    Seen in 2 reports
  11. Delay reclamation of the shared IPv4 options object until existing readers finish, for example with RCU freeing.

    Seen in 2 reports
  12. Destroy connections and release references before deletion, and re-validate pointers after freeing arrays.

    Seen in 2 reports
  13. Do not call a second close function on a pointer already freed by the first.

    Seen in 2 reports
  14. Do not deserialise untrusted data into trusted object types, or validate its origin and content first.

    Seen in 2 reports
  15. Do not pass externally controlled data as a format string; use fixed format specifiers.

    Seen in 2 reports
  16. Do not use user-supplied strings as format specifiers.

    Seen in 2 reports
  17. Ensure error returns still perform cleanup and do not leave handles to be destroyed twice.

    Seen in 2 reports
  18. Flush queued data before detaching or freeing the transfer object.

    Seen in 2 reports
  19. Free a buffer with the same allocator that allocated it.

    Seen in 2 reports
  20. Give base classes virtual destructors so derived objects are deleted correctly.

    Seen in 2 reports
  21. Guard iteration against re-entrant mutation of the container, for example by copying the list or deferring removals.

    Seen in 2 reports
  22. Hold the guarding lock when reading members in destructors, and register pointers into compactable storage as movable references.

    Seen in 2 reports
  23. Improve input validation before using user-supplied data.

    Seen in 2 reports
  24. Improve memory handling in the kernel.

    Seen in 2 reports
  25. Improve memory handling so objects are not used after being freed, as stated for the browser engine and process model fixes.

    Seen in 2 reports
  26. Increase reference counts when storing objects and avoid releasing objects still referenced elsewhere.

    Seen in 2 reports
  27. Initialise memory buffers before use and release an updated build.

    Seen in 2 reports
  28. Initialise the iovector length field before processing a MAYBE call.

    Seen in 2 reports
  29. Keep the finished source handler list consistent when the active list is cleared, and do not erase a handler before calling a method on it.

    Seen in 2 reports
  30. Keep the provider library context alive until every SSL_CTX created from it has been destroyed, including connections on the shutdown list.

    Seen in 2 reports
  31. Limit the number of characters read into fixed-size buffers instead of using unbounded string formats.

    Seen in 2 reports
  32. Make cleanup code free each object once and only when it owns it.

    Seen in 2 reports
  33. Make the validation limit match the destination buffer size.

    Seen in 2 reports
  34. Manage object lifetimes when form field events trigger page deletion.

    Seen in 2 reports
  35. Pass the actual buffer length to the image converter and validate bitmap header fields before computing sizes.

    Seen in 2 reports
  36. Patch the PHP engine itself rather than the application, since the flaws sit in request parsing and cleanup before application code runs.

    Seen in 2 reports
  37. Place the setjmp checkpoint in the function that calls the decode routines so the handler frame is still live on longjmp.

    Seen in 2 reports
  38. Randomise code layout, blind constants and limit the number of executable regions per module.

    Seen in 2 reports
  39. Range-check parsed fields against the specification and verify data precision matches the output format before copying.

    Seen in 2 reports
  40. Re-fetch the socket entry after invoking a callback that may free it, as was done in the update leg.

    Seen in 2 reports
  41. Re-run variable collection and loop classification after optimisation passes that remove or reclassify nodes.

    Seen in 2 reports
  42. Re-validate the result kind after side effects and keep receiver type checks in optimisations.

    Seen in 2 reports
  43. Recreate or resize encoder state when layer counts or macroblock grids change instead of reusing stale configuration.

    Seen in 2 reports
  44. Reject non-positive kernel unit lengths in the filter attribute setters rather than relying on debug assertions.

    Seen in 2 reports
  45. Reserve space for the null terminator and use a greater-or-equal comparison so a value exactly equal to the buffer size is rejected.

    Seen in 2 reports
  46. Reset handles and cookies to null after closing or completing an operation.

    Seen in 2 reports