- Reported
-
- Issued
-
- Package
-
orx-pinned-vec
(crates.io)
- Type
-
INFO
Unsound
- Categories
-
- Keywords
-
#undefined-behavior
#soundness
- References
-
- Patched
-
- Affected Functions
- Version
orx_pinned_vec::utils::slice::index_of_ptr
-
Description
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.
Advisory available under CC0-1.0
license.