Skip to content
OpenAdvisories
Medium · 6.2 GHSA-74r5-g7vc-j2v2 RUSTSEC-2024-0346

zerovec-derive incorrectly uses `#[repr(packed)]`

Published Jul 8, 2024 · Updated Sep 10, 2026 · Assigned by GHSA

Description

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.

Affected packages

EcosystemPackageAffectedFixedRecord
crates.io zerovec-derive >= 0.10.0, < 0.10.3 0.10.3 GHSA-74r5-g7vc-j2v2
crates.io zerovec-derive < 0.9.7 0.9.7 GHSA-74r5-g7vc-j2v2
crates.io zerovec-derive >= 0.0.0-0, < 0.9.7 · >= 0.10.0, < 0.10.3 0.9.7, 0.10.3 RUSTSEC-2024-0346

References