GHSA-74r5-g7vc-j2v2

Suggest an improvement
Source
https://github.com/advisories/GHSA-74r5-g7vc-j2v2
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/07/GHSA-74r5-g7vc-j2v2/GHSA-74r5-g7vc-j2v2.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-74r5-g7vc-j2v2
Related
Published
2024-07-08T18:39:18Z
Modified
2024-07-09T19:45:09Z
Severity
  • 6.2 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N CVSS Calculator
  • 6.9 (Medium) CVSS_V4 - CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N CVSS Calculator
Summary
zerovec-derive incorrectly uses `#[repr(packed)]`
Details

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.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-120"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2024-07-08T18:39:18Z"
}
References

Affected packages

crates.io / zerovec-derive

Package

Name
zerovec-derive
View open source insights on deps.dev
Purl
pkg:cargo/zerovec-derive

Affected ranges

Type
SEMVER
Events
Introduced
0.10.0
Fixed
0.10.3

crates.io / zerovec-derive

Package

Name
zerovec-derive
View open source insights on deps.dev
Purl
pkg:cargo/zerovec-derive

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.9.7