{"id":"RUSTSEC-2026-0302","revision":"5e60fbf3cbbf4dddbbf2b788c5ce809e","records":[{"revision":"5e60fbf3cbbf4dddbbf2b788c5ce809e","observedAt":"2026-10-24T13:19:54.901+00:00","statement":{"source":"osv","id":"RUSTSEC-2026-0302","aliases":[],"title":"`stack-graphs` C API exports are safe `extern \"C\"` functions","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.\n\n`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.\n\nThe 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.","state":0,"publishedAt":"2026-09-22T12:00:00+00:00","modifiedAt":"2026-09-22T21:00:02.8795157+00:00","affected":[{"ecosystem":"crates.io","name":"stack-graphs","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0.0.3-0"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[],"references":["https://crates.io/crates/stack-graphs","https://rustsec.org/advisories/RUSTSEC-2026-0302.html","https://github.com/rustsec/advisory-db/issues/3241","https://github.com/github/stack-graphs"],"sourceUrl":"https://osv.dev/vulnerability/RUSTSEC-2026-0302","license":"OSV · upstream source license applies","key":"osv:RUSTSEC-2026-0302","identifiers":["RUSTSEC-2026-0302"]},"retained":false,"historicalAffected":[]}],"coverage":[]}