File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` toml
2+ [advisory ]
3+ id = " RUSTSEC-0000-0000"
4+ package = " ferris-says"
5+ date = " 2024-01-13"
6+ url = " https://github.com/rust-lang/ferris-says/pull/21"
7+ informational = " unsound"
8+
9+ [versions ]
10+ patched = [" >= 0.3.1" ]
11+ unaffected = [" <= 0.1.2" ]
12+ ```
13+
14+ # Unsound use of str::from_utf8_unchecked on bytes which are not UTF-8
15+
16+ Affected versions receive a ` &[u8] ` from the caller through a safe API, and pass
17+ it directly to the unsafe ` str::from_utf8_unchecked ` function.
18+
19+ The behavior of ` ferris_says::say ` is undefined if the bytes from the caller
20+ don't happen to be valid UTF-8.
21+
22+ The flaw was corrected in [ ferris-says #21 ] by using the safe ` str::from_utf8 `
23+ instead, and returning an error on invalid input. However this fix has not yet
24+ been published to crates.io as a patch version for 0.2.
25+
26+ Separately, [ ferris-says #32 ] has introduced a different API for version 0.3
27+ which accepts input as ` &str ` rather than ` &[u8] ` , so is unaffected by this bug.
28+
29+ [ ferris-says#21 ] : https://github.com/rust-lang/ferris-says/pull/21
30+ [ ferris-says#32 ] : https://github.com/rust-lang/ferris-says/pull/32
You can’t perform that action at this time.
0 commit comments