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.
-
Improve bounds checking before reading memory.
-
Improve bounds checking in the USB handling code.
-
Improve input validation to prevent integer overflow when processing 3D models.
-
Improved input validation for the out-of-bounds read.
-
Improved input validation in file parsing.
-
Improved memory management for the use-after-free.
-
Include alignment padding when calculating the required buffer size before copying.
-
Include all backend-specific size fields in cache keys so entries cannot alias.
Seen in 1 report
-
Include the negative-zero case in the typer for maths builtins so the comparison is not folded to a constant.
Seen in 1 report
-
Include the size of each operation when calculating the response buffer size.
Seen in 1 report
-
Include the texture resource type in the staging texture cache check.
Seen in 1 report
-
Increment the module script reference count when storing it in a function slot.
-
Increment the reference count when assigning a raw pointer so error paths do not free it twice.
Seen in 1 report
-
Initialise and validate every element of the format array when the format line is empty or invalid.
Seen in 1 report
-
Initialise margin values before the used margin calculation.
-
Initialise the dynamic buffer before the early-return check so the error path does not free an uninitialised pointer.
Seen in 1 report
-
Initialise the format pointer before the conditional branches.
Seen in 1 report
-
Initialise the full decoder state in constructors rather than relying on the caller.
Seen in 1 report
-
Initialise the read count before the stream read and handle the closed-stream case.
Seen in 1 report
-
Initialise the residue pointer before it can be used.
Seen in 1 report
-
Invalidate an annotation object after destruction so a second destroy call cannot operate on freed memory.
Seen in 1 report
-
Invalidate other server-side sessions when the password changes.
Seen in 1 report
-
Invalidate the certificate stats cache when a new transport name appears, and check the lookup result in release builds.
Seen in 1 report
-
Invalidate the Java-side pointer when the native object is deleted, and disable interaction during dismissal animations.
Seen in 1 report
-
Keep cache names in a single encoding so distinct names cannot alias.
Seen in 1 report
-
Keep duplicate-ID checks in release builds and use a wider or checked counter.
Seen in 1 report
-
Keep the context stack consistent around method_missing so the garbage collector sees valid pointers.
Seen in 1 report
-
Keep the global context alive until all dependent objects are gone.
Seen in 1 report
-
Keep the JavaScript engine runtime consistent when a binding throws during nested execution.
Seen in 1 report
-
Keep the mapping alive for as long as asynchronous code may read the pointer.
-
Keep the page pinned while cached page-object handles are still held.
Seen in 1 report
-
Keep the string buffer alive while building an error message across nested allocations.
Seen in 1 report
-
Keep the text field object alive while a handler may still reference it.
Seen in 1 report
-
Keep typed-array backing stores pinned across direct native calls.
Seen in 1 report
-
Leave space for the subsequent concatenation when copying the token into the fixed buffer.
Seen in 1 report
-
Limit the locale length before passing it to ICU, and check the length before copying into the stack buffer.
Seen in 1 report
-
Limit the read size passed to the underlying stream to the caller's requested count.
Seen in 1 report
-
Make the deoptimizer traverse all Wasm stacks including those used by JSPI during lazy deoptimisation.
Seen in 1 report
-
$55,000 High
-
-
Move image parsing out of the unsandboxed browser process or use a memory-safe parser.
Seen in 1 report
-
Null the pointer after freeing an object so later checks cannot be bypassed.
Seen in 1 report
-
Null the root popup menu pointer after freeing it and guard against re-entry during teardown.
Seen in 1 report
-
Null-terminate file data read into fixed buffers before passing it to string functions.
Seen in 1 report
-
Null-terminate private-key blobs before passing them to the key parser, matching the certificate and CA paths.
-
Pass device-supplied strings as arguments to the format function rather than as the format string.
-
Pass the actual output buffer size to the app data copy routine rather than a larger value.
-
Pass the captured length rather than the on-wire length to the Ethernet printer.
-
Pass the destination buffer size as the copy limit rather than the token length.
-
Pass the user-supplied message as an argument to the error function rather than as the format string.
Seen in 1 report
-
Patch the shipped Ruby and apply the vendor advisories for the regex compiler bugs.
Seen in 1 report
-
Perform overflow checks on unsigned values so the compiler cannot remove them as undefined behaviour.
Seen in 1 report