RUSTSEC-2026-0302 `stack-graphs` C API exports are safe `extern "C"` functions

Not scored Published

Safe Rust code can trigger undefined behavior and potential crashes or code execution by calling unsafe C API functions in the stack-graphs library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Not stated
Victim action needed
Not needed
Fix
None listed

What is RUSTSEC-2026-0302?

RUSTSEC-2026-0302 is a memory corruption vulnerability in stack-graphs, published on 22 Sep 2026.

Official description

stack_graphs::c is a public module. From 0.0.3 through the current crates.io release 0.14.1, its pointer-taking entry points are pub extern "C" fn rather than unsafe fn. Safe Rust can call them.

sg_stack_graph_free frees the pointer with Box::from_raw. sg_stack_graph_free(std::ptr::null_mut()) is immediate undefined behavior. The same shape is used by the other *_free exports and by getters and mutators that dereference the caller-supplied pointer or pass it to from_raw_parts (sg_stack_graph_nodes, sg_stack_graph_add_edges, and the rest of the pointer-taking functions in src/c.rs). Constructors that take no pointer are not part of this issue.

The upstream repository is archived, so a fix cannot be filed there and no patched release exists. The soundness fix is to make every pointer-taking export unsafe extern "C" fn, with a safety comment that the pointer is non-null and, for free, came from the matching constructor.

Which versions are affected by RUSTSEC-2026-0302?

1 open source package ship an affected version, including stack-graphs.

PackageAffectedFixed in
stack-graphs crates.ioFrom 0.0.3-0None

How do I fix RUSTSEC-2026-0302?

No fix has been published for RUSTSEC-2026-0302 yet. Limit exposure of the affected software until one is available.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is RUSTSEC-2026-0302 being exploited?

There is no known exploitation of RUSTSEC-2026-0302 in the wild and no public exploit code.

Sources

Is RUSTSEC-2026-0302 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free