# GHSA-2RXC-GJRP-VJHX: Unsoundness in anstream

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2024-12-04
- Modified: 2026-09-10

## Also published as

- [RUSTSEC-2024-0404](https://cve.now/RUSTSEC-2024-0404.md) (RustSec)

## Affected versions

- anstream (crates.io): fixed in 0.6.8

## 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.

## References

- https://github.com/rust-cli/anstyle/issues/156
- https://github.com/rust-cli/anstyle
- https://rustsec.org/advisories/RUSTSEC-2024-0404.html

Page: https://cve.now/GHSA-2RXC-GJRP-VJHX

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
