GHSA-xrv3-jmcp-374j

Suggest an improvement
Source
https://github.com/advisories/GHSA-xrv3-jmcp-374j
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/07/GHSA-xrv3-jmcp-374j/GHSA-xrv3-jmcp-374j.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-xrv3-jmcp-374j
Related
Published
2024-07-08T18:36:40Z
Modified
2024-07-08T18:36:40Z
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 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.4 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:36:40Z"
}
References

Affected packages

crates.io / zerovec

Package

Affected ranges

Type
SEMVER
Events
Introduced
0.10.0
Fixed
0.10.4

crates.io / zerovec

Package

Affected ranges

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