← ClaudeAtlas

detecting-memory-safety-bugslisted

Find memory-safety bugs in C/C++ and other unmanaged code - use-after-free, double-free, out-of-bounds read/write, uninitialized use, and NULL deref - by reasoning about object lifetime and buffer bounds along real code paths. Use on an authorized source target when a candidate catalog does NOT model these temporal/lifetime classes (most don't), so a keyword or sink scan will miss them; when reviewing allocators, parsers, buffer handling, or refcounting. Pairs the lifetime/bounds reasoning with source→sink confirmation and the shared finding schema.
UnboundCompute/security-agent-skills · ★ 4 · AI & Automation · score 80
Install: claude install-skill UnboundCompute/security-agent-skills
# Detecting memory-safety bugs Temporal and spatial memory bugs are the ones a sink-based catalog usually *doesn't* model: there's no single "dangerous function" to grep - the bug is a relationship between a pointer's lifetime and its use, or between an index and a bound, spread across code paths. So you hunt them by reasoning about lifetime and bounds, not by matching a call. This skill covers the five workhorse classes and how to confirm each. ## When to use - The target is C/C++/Rust-unsafe/CGo or any unmanaged memory, and you want the classes a catalog leaves out (`hunting-bugs-with-a-code-graph` flags these as out-of-catalog and sends you here). - You're reviewing allocators, parsers, serializers, ring buffers, refcounting, or anything doing pointer arithmetic. ## Scope check Authorized source only. If you can't name the authorization, stop. ## The five classes and how to confirm each For every candidate, the confirmation is a *path*: an allocation/definition site, the operation that changes its state, and the use - read the source at each. 1. **Use-after-free (UAF).** A pointer is used after its object is freed. Hunt: for each `free`/`delete`/refcount-drop, ask *what still holds this pointer* and *can any path reach a use after this point* - including aliases stored in structs, callbacks, and error paths. Confirm: a live path free → … → deref with no reassignment in between. Watch the classic shapes: free-in-a-loop then use, free in an error