Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions crates/potato/RUSTSEC-0000-0000.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```toml
[advisory]
id = "RUSTSEC-0000-0000"
package = "potato"
date = "2026-05-02"
url = "https://github.com/fawdlstty/potato/issues/1"
informational = "unsound"
categories = ["memory-corruption"]
keywords = ["undefined-behavior", "utf-8"]

[versions]
patched = []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a fix has been released for this issue.

```

# `RefStr::from_slice()` allows constructing invalid UTF-8 from safe code

`RefStr::from_slice(data, start, len)` is declared safe but uses
`unsafe { data.get_unchecked(start) }` internally without validating `start`
and `len`. Callers can construct a `RefStr` pointing to arbitrary bytes.

Combined with `to_str()`, which calls `std::str::from_utf8_unchecked()` on
the underlying bytes, a caller can produce an invalid `&str` that violates
Rust's safety requirements. For example, slicing a multi-byte UTF-8 character
in the middle produces an invalid `&str`.

Both `from_slice()` and `to_str()` are public safe APIs, so this undefined
behavior can be triggered without writing any `unsafe` code.