Email me

Rust advisories / stack-graphs

UnsoundRUSTSEC-2026-0302 · stack-graphs

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

Short answerstack-graphs has an API that can cause undefined behaviour from safe code: `stack-graphs` C API exports are safe `extern "C"` functions. No fixed version yet.

Cratestack-graphs
TypeUnsound (memory-corruption)
Affected versionsFrom 0.0.3 onward (every version).
Fixed innone
Severitynot scored
Published2026-09-22
Last changed2026-09-22
Also known asnone
Affected functionsstack_graphs::c::sg_stack_graph_free

What to do

  1. Find who pulls it in: cargo tree -i stack-graphs.
  2. Avoid the affected API (stack_graphs::c::sg_stack_graph_free), or replace the crate.

Details from the advisory

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.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for stack-graphs

Full security history of stack-graphs

Up next

Same cratestack-graphs: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ