Email me

Rust advisories / rocket

Unsound HighRUSTSEC-2021-0044 · rocket

RUSTSEC-2021-0044: Use after free possible in `uri::Formatter` on panic

Short answerrocket has an API that can cause undefined behaviour from safe code: Use after free possible in `uri::Formatter` on panic. Fixed in 0.4.7.

Craterocket
TypeUnsound (memory-corruption)
Affected versionsBefore 0.4.7.
Fixed in0.4.7
SeverityHigh, CVSS 7.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L
Published2021-02-09
Last changed2023-11-08
Also known asCVE-2021-29935, GHSA-vcw4-8ph6-7vw8

What to do

  1. See which version you have: cargo tree -i rocket (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p rocket. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example rocket = "0.4.7") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

Affected versions of this crate transmuted a &str to a &'static str before pushing it into a StackVec, this value was then popped later in the same function.

This was assumed to be safe because the reference would be valid while the method's stack was active. In between the push and the pop, however, a function f was called that could invoke a user provided function.

If the user provided panicked, then the assumption used by the function was no longer true and the transmute to &'static would create an illegal static reference to the string. This could result in a freed string being used during (such as in a Drop implementation) or after (e.g through catch_unwind) the panic unwinding.

This flaw was corrected in commit e325e2f by using a guard object to ensure that the &'static str was dropped inside the function.

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 rocket

Full security history of rocket

Up next

Same craterocket: 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