The safe function index_of_ptr causes undefined behavior when called with an empty slice.
The issue occurs in the line ptr.add(slice.len() - 1) which underflows when slice.len() is 0, creating a pointer with a massive offset. According to Rust's safety rules, creating such a pointer causes immediate undefined behavior.
{
"nvd_published_at": null,
"severity": "LOW",
"github_reviewed": true,
"cwe_ids": [
"CWE-119",
"CWE-191"
],
"github_reviewed_at": "2025-10-21T21:54:27Z"
}