# RUSTSEC-2025-0166: Multiple soundness issues in `stackvector`

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2025-10-23T12:00:00.000Z
- Modified: 2026-07-02T08:00:03.852Z

## Description

Affected versions of `stackvector` contained multiple soundness issues that could allow safe Rust code to trigger undefined behavior.

One issue was that `StackVec::length` was exposed as a public field. Safe Rust code could set `length` to a value larger than the backing array capacity. Other safe methods, including `remove`, `pop`, and `truncate`, relied on `length` before performing unsafe pointer operations (`ptr::read`, `ptr::copy`, `offset`/`add`). If `length` was corrupted by safe code, these methods could perform out-of-bounds pointer arithmetic, reads, writes, or copies.

The upstream maintainer also identified additional soundness issues, including the use of `mem::uninitialized` in `StackVec::from_vec_unchecked`, which was reachable through `from_vec`, and Miri violations related to `MaybeUninit` usage.

Version `2.0.0` was released to fix the known soundness issues.

(As written by RustSec Advisory Database.)

## Affected

- stackvector (crates.io): from 0.0.0-0 before 2.0.0

## References

- <https://crates.io/crates/stackvector> (package)
- <https://rustsec.org/advisories/RUSTSEC-2025-0166.html> (advisory)
- <https://github.com/Alexhuszagh/rust-stackvector/issues/3> (report)
- <https://github.com/Alexhuszagh/rust-stackvector/pull/6> (web)
- <https://github.com/Alexhuszagh/rust-stackvector/commit/02b947afdeeb1be95ec0888354aa76afdd9d0357> (web)
- <https://github.com/Alexhuszagh/rust-stackvector/issues/5> (report)

## Sources

- RustSec Advisory Database: [RUSTSEC-2025-0166](https://rustsec.org/advisories/RUSTSEC-2025-0166.html), CC0-1.0, modified 2026-07-02

---

Page: https://cve.day/RUSTSEC-2025-0166 · Whole record: https://cve.day/RUSTSEC-2025-0166.json · Rebuilt by cve.day 2026-11-25T22:56:43.296Z
