GHSA-74r5-g7vc-j2v2: zerovec-derive incorrectly uses `#[repr(packed)]`
The affected versions make unsafe memory accesses under the assumption that #[repr(packed)] has a guaranteed field order. The Rust specification does not guarantee this, and https://github.com/rust-lang/rust/pull/125360 (1.80.0-beta) starts reordering fields of #[repr(packed)] structs, leading to illegal memory accesses. The patched versions 0.9.7 and 0.10.3 use #[repr(C, packed)], which guarantees field order.
Published Jul 8, 2024 · Updated Aug 8, 2024
Affected packages
zerovec-derive
- Ecosystem
- Rust (crates.io)
- Affected
- < 0.9.7
- Fixed in
- 0.9.7
- Check
cargo tree -i zerovec-derive
zerovec-derive
- Ecosystem
- Rust (crates.io)
- Affected
- >= 0.10.0, < 0.10.3
- Fixed in
- 0.10.3
- Check
cargo tree -i zerovec-derive
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
The affected versions make unsafe memory accesses under the assumption that #[repr(packed)] has a guaranteed field order.
The Rust specification does not guarantee this, and https://github.com/rust-lang/rust/pull/125360 (1.80.0-beta) starts reordering fields of #[repr(packed)] structs, leading to illegal memory accesses.
The patched versions 0.9.7 and 0.10.3 use #[repr(C, packed)], which guarantees field order.
Credited to hikiko4ern.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
