# GHSA-2rxc-gjrp-vjhx: Unsoundness in anstream

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2024-09-08T12:00:00.000Z
- Modified: 2026-09-10T03:50:21.162Z
- Also known as: RUSTSEC-2024-0404

## Description

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.

(As written by GitHub Advisory Database.)

## Affected

- anstream (crates.io): before 0.6.8; from 0.0.0-0 before 0.6.8

## References

- <https://github.com/rust-cli/anstyle/issues/156> (report, web)
- <https://github.com/rust-cli/anstyle> (package)
- <https://rustsec.org/advisories/RUSTSEC-2024-0404.html> (advisory, web)
- <https://crates.io/crates/anstream> (package)

## Sources

- GitHub Advisory Database: [GHSA-2rxc-gjrp-vjhx](https://github.com/advisories/GHSA-2rxc-gjrp-vjhx), CC-BY-4.0, modified 2026-09-10
- RustSec Advisory Database: [RUSTSEC-2024-0404](https://rustsec.org/advisories/RUSTSEC-2024-0404.html), CC0-1.0, modified 2026-07-17

---

Page: https://cve.day/GHSA-2rxc-gjrp-vjhx · Whole record: https://cve.day/GHSA-2rxc-gjrp-vjhx.json · Rebuilt by cve.day 2026-11-25T22:56:43.225Z
