Email me

Rust advisories / anstream

Unsound MediumRUSTSEC-2024-0404 · anstream

RUSTSEC-2024-0404: Unsoundness in anstream

Short answeranstream has an API that can cause undefined behaviour from safe code: Unsoundness in anstream. Fixed in 0.6.8.

Crateanstream
TypeUnsound
Affected versionsBefore 0.6.8.
Fixed in0.6.8
SeverityMedium (GitHub rating)
Published2024-09-08
Last changed2026-07-17
Also known asGHSA-2rxc-gjrp-vjhx
Affected functionsanstream::adapter::strip_str

What to do

  1. See which version you have: cargo tree -i anstream (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p anstream. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example anstream = "0.6.8") 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

When given a valid UTF8 string "ö\x1b😀", the function in crates/anstream/src/adapter/strip.rs will be confused. The UTF8 bytes are \xc3\xb6 then \x1b then \xf0\x9f\x98\x80.

When looping over "non-printable bytes" \x1b\xf0 will be considered as some non-printable sequence.

This will produce a broken str from the incorrectly segmented bytes via str::from_utf8_unchecked, and that should never happen.

Full credit goes to @Ralith who reviewed this code and asked @burakemir to follow up.

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.

Up next

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