Skip to content

Set pointers to NULL after free #42

@jvoisin

Description

@jvoisin

As suggested in Google's Safer usage of C++:

[…] nullifying pointers after free (by compiler). After delete foo->bar, add foo->bar = nullptr. Obviously, it’ll fix a small portion of cases (guesstimate: 1% – 10%); e.g. it can't handle delete GetBar();. But it’s ~ zero overhead and relatively easy to implement. LLVM patches have been floating around (but IDK the current state).”

Benefits: Detect 1 – 10% of UAFs. Improved developer ergonomics (modulo aliasing, the contents of a region after free and before it is reused are now defined).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions