Headline
GHSA-2rxc-gjrp-vjhx: Unsoundness in anstream
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.
Skip to content
Navigation Menu
GitHub Copilot
Write better code with AI
Security
Find and fix vulnerabilities
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Discussions
Collaborate outside of code
Code Search
Find more, search less
Explore
- Learning Pathways
- White papers, Ebooks, Webinars
- Customer Stories
- Partners
- Executive Insights
GitHub Sponsors
Fund open source developers
* The ReadME Project
GitHub community articles
Enterprise platform
AI-powered developer platform
- Pricing
Provide feedback
Saved searches****Use saved searches to filter your results more quickly
Sign up
- GitHub Advisory Database
- GitHub Reviewed
- GHSA-2rxc-gjrp-vjhx
Unsoundness in anstream
Moderate severity GitHub Reviewed Published Dec 4, 2024 to the GitHub Advisory Database • Updated Dec 4, 2024
Package
cargo anstream (Rust)
Affected versions
< 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
- rust-cli/anstyle#156
- https://rustsec.org/advisories/RUSTSEC-2024-0404.html
Published to the GitHub Advisory Database
Dec 4, 2024