# GHSA-v363-rrf2-5fmj: ferris-says has undefined behavior when not using UTF-8

- Severity: Low (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2024-01-13T12:00:00.000Z
- Modified: 2024-02-10T16:26:48.909Z
- Also known as: RUSTSEC-2024-0001

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

[ferris-says#21]: https://github.com/rust-lang/ferris-says/pull/21
[ferris-says#32]: https://github.com/rust-lang/ferris-says/pull/32

(As written by GitHub Advisory Database.)

## Affected

- ferris-says (crates.io): from 0.1.2 up to 0.2.1; from 0.3.0 before 0.3.1; from 0.1.3-0 before 0.3.1

## References

- <https://github.com/rust-lang/ferris-says/pull/21> (web)
- <https://github.com/rust-lang/ferris-says/commit/bb661f29e0d88968c495a4ea4dc63ff0e2c2c11a> (web)
- <https://github.com/mgattozzi/ferris-says> (package)
- <https://rustsec.org/advisories/RUSTSEC-2024-0001.html> (advisory, web)
- <https://crates.io/crates/ferris-says> (package)

## Sources

- GitHub Advisory Database: [GHSA-v363-rrf2-5fmj](https://github.com/advisories/GHSA-v363-rrf2-5fmj), CC-BY-4.0, modified 2024-02-10
- RustSec Advisory Database: [RUSTSEC-2024-0001](https://rustsec.org/advisories/RUSTSEC-2024-0001.html), CC0-1.0, modified 2024-02-10

---

Page: https://cve.day/GHSA-v363-rrf2-5fmj · Whole record: https://cve.day/GHSA-v363-rrf2-5fmj.json · Rebuilt by cve.day 2026-11-25T22:56:43.181Z
