GitHub Advisoryadvisory · crates.io

GHSA-h5j3-crg5-8jqm orx-pinned-vec has undefined behavior in index_of_ptr with empty slices

LOW Published 2025-10-21 Modified 2025-10-21 Official page ↗
Ecosystem
crates.io
Packages
orx-pinned-vec
Severity
Low
CVSS vector
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P
Weaknesses
CWE-119, CWE-191
Reviewed
2025-10-21

Affected packages

• crates.io orx-pinned-vec: < 3.21.0 → fixed in 3.21.0

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.

Related

Weakness · CWE (2)

  • CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer weakness
  • CWE-191 Integer Underflow (Wrap or Wraparound) weakness

References