GHSA-v363-rrf2-5fmj ferris-says has undefined behavior when not using UTF-8
- Published
- Updated
- Exploit status
- No public exploit known
Description
Affected versions receive a &[u8] from the caller through a safe API, and pass it directly to the unsafe str::from_utf8_unchecked function.
The behavior of ferris_says::say is undefined if the bytes from the caller don't happen to be valid UTF-8.
The flaw was corrected in ferris-says#21 by using the safe str::from_utf8 instead, and returning an error on invalid input. However this fix has not yet been published to crates.io as a patch version for 0.2.
Separately, ferris-says#32 has introduced a different API for version 0.3 which accepts input as &str rather than &[u8], so is unaffected by this bug.
Upgrade path
1 package: 1 fixed.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| crates.io ferris-says(crates.io) | >= 0.1.2, <= 0.2.1; >= 0.1.3-0, < 0.3.1; >= 0.3.0, < 0.3.1 | 0.3.1 | Fixed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| crates.io ferris-says(crates.io) | >= 0.1.2, <= 0.2.1 | No fix listed |
| crates.io ferris-says(crates.io) | >= 0.3.0, < 0.3.1 | 0.3.1 |
| crates.io ferris-says(crates.io) | >= 0.1.3-0, < 0.3.1 | 0.3.1 |
References
- github.com patch
- github.com patch
- github.com product
- rustsec.org vendor-advisory
- crates.io product
- github.com