zerovec incorrectly uses `#[repr(packed)]`
Moderate severity
GitHub Reviewed
Published
Jul 8, 2024
to the GitHub Advisory Database
•
Updated Aug 7, 2024
Description
Published to the GitHub Advisory Database
Jul 8, 2024
Reviewed
Jul 8, 2024
Last updated
Aug 7, 2024
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 rust-lang/rust#125360 (1.80.0-beta) starts
reordering fields of
#[repr(packed)]
structs, leading to illegal memory accesses.The patched versions
0.9.7
and0.10.4
use#[repr(C, packed)]
, which guarantees field order.References