Rust advisories / os_str_bytes
Vulnerability HighRUSTSEC-2020-0012 · os_str_bytes
RUSTSEC-2020-0012: Relies on undefined behavior of `char::from_u32_unchecked`
Short answerA security vulnerability in the os_str_bytes crate: Relies on undefined behavior of `char::from_u32_unchecked`. High severity (CVSS 7.5). Fixed in 2.0.0: update to a fixed version.
| Crate | os_str_bytes |
|---|---|
| Type | Vulnerability |
| Affected versions | Before 2.0.0. |
| Fixed in | 2.0.0 |
| Severity | High, CVSS 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Published | 2020-04-24 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2020-35865, GHSA-q948-x8rf-888m |
What to do
- See which version you have:
cargo tree -i os_str_bytes(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p os_str_bytes. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampleos_str_bytes = "2.0.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
The Windows implementation of this crate relied on the behavior of std::char::from_u32_unchecked when its safety clause is violated. Even though this worked with Rust versions up to 1.42 (at least), that behavior could change with any new Rust version, possibly leading a security issue.
The flaw was corrected in version 2.0.0.
References
- Package: crates.io/crates/os_str_bytes
- Advisory: rustsec.org/advisories/RUSTSEC-2020-0012.html
- Web: github.com/dylni/os_str_bytes/pull/1
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
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?