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 401 to 450 of 976
  1. Reset iterators that track append positions whenever the range they point into is removed, regardless of timestamp state.

    Seen in 2 reports
  2. Reset the phi node traversal state between calls and verify all inputs before marking a node as zero-extended.

    Seen in 2 reports
  3. Run state restore and cleanup on failure paths as well as success paths.

    Seen in 2 reports
  4. Sanitise hashes and enums so they cannot equal reserved sentinel keys.

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

    Seen in 2 reports
  6. Set the handle's cookie pointer to null after freeing the cookie store, and sort only the filled entries.

    Seen in 2 reports
  7. Size the buffer for all samples per pixel rather than the smaller of tile and image dimensions.

    Seen in 2 reports
  8. Stop JavaScript execution when the document closes and clear references to freed objects.

    Seen in 2 reports
  9. String methods should re-read the buffer pointer and length after argument conversion and after yielding to user blocks.

    Seen in 2 reports
  10. Synchronise document close and page close actions so freed objects are not reused.

    Seen in 2 reports
  11. Synchronise object destruction with use on other threads.

    Seen in 2 reports
  12. The user-supplied length should be kept unsigned or range-checked before use in size calculations and allocations.

    Seen in 2 reports
  13. Track ownership of canvas and stream objects so they are destroyed once.

    Seen in 2 reports
  14. Treat an invalid block switch as a fatal format error rather than a need for more input, and bounds-check the streaming buffer.

    Seen in 2 reports
  15. Unlink an association object from its group before freeing it.

    Seen in 2 reports
  16. Use a full-width size calculation and check the computed allocation size before copying record data.

    Seen in 2 reports
  17. Use each chroma plane's own stride when copying.

    Seen in 2 reports
  18. Use the same size calculation for allocation and for the read or write, and validate the two against each other.

    Seen in 2 reports
  19. Validate attacker-controlled length fields against the actual buffer size before indexing or setting memory.

    Seen in 2 reports
  20. Validate indices in bracket data insertion and segment building.

    Seen in 2 reports
  21. Validate length fields from server packets before using them in arithmetic or decryption.

    Seen in 2 reports
  22. Validate lengths and offsets from network data against the size of the allocated buffer.

    Seen in 2 reports
  23. Validate numeric input and handle overflow and truncation safely.

    Seen in 2 reports
  24. Validate object existence and array indices before use.

    Seen in 2 reports
  25. Validate pointers received from untrusted sources before dereferencing them.

    Seen in 2 reports
  26. Validate pointers supplied from user mode before dereferencing them in kernel code.

    Seen in 2 reports
  27. Validate register indices and operands in shader bytecode before using them to compute write addresses.

    Seen in 2 reports
  28. Validate shader-supplied indices and repeat counts before using them as write addresses or loop bounds.

    Seen in 2 reports
  29. Validate size values and use widened arithmetic before allocating buffers.

    Seen in 2 reports
  30. Validate that file-supplied values used as lookup table indices are within the table bounds.

    Seen in 2 reports
  31. Validate that the calculated authentication trailer pointer stays within the received packet buffer.

    Seen in 2 reports
  32. Validate the integer from the file before using it to calculate a buffer size.

    Seen in 2 reports
  33. Validate the size and bounds of user-supplied data before writing to a buffer.

    Seen in 2 reports
  34. Validate the user-supplied resource index and check the fallback resource pointer before use.

    Seen in 2 reports
  35. Validate values taken from input before using them as pointers.

    Seen in 2 reports
  36. Verify the backend type and expected interface before casting or constructing.

    Seen in 2 reports
  37. Verify the record size read from the file is smaller than the fixed record buffer before copying.

    Seen in 2 reports
  38. Abort after raising the exception rather than storing an error sentinel as the component count in PDF colour space handling.

    Seen in 1 report
  39. Abort processing when a size or consistency check fails instead of continuing to decode.

    Seen in 1 report
  40. Account for quads split during clipping when sizing batches against the index buffer.

    Seen in 1 report
  41. Account for re-entrant JavaScript during microtask checkpoints and re-check the parser object after navigation.

    Seen in 1 report
  42. Check that the mapped buffer byte count is at least the MAC header size plus the VLAN tag length before processing Wi-Fi frames.

    Seen in 1 report
  43. Add a default case and a trailing return to switches over renderer-controlled values such as accessibility enums.

    Seen in 1 report
  44. Add a re-entrancy guard to the cw-pause writer as was done for cw-out.

    Seen in 1 report
  45. Add a self-assignment check to the move assignment operator.

    Seen in 1 report
  46. Add a size check before reading headers into a fixed-size buffer.

    Seen in 1 report
  47. Add a type check in the jsToWasm inline-cache entrypoint.

    Seen in 1 report
  48. Add bounds checks before writing to memory buffers while parsing archives.

    Seen in 1 report
  49. Add bounds checks on the plane number and write pointer in the RLE decoder.

    Seen in 1 report