GHSA-wfg4-322g-9vqv

Suggest an improvement
Source
https://github.com/advisories/GHSA-wfg4-322g-9vqv
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/06/GHSA-wfg4-322g-9vqv/GHSA-wfg4-322g-9vqv.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-wfg4-322g-9vqv
Aliases
Published
2023-06-21T22:06:29Z
Modified
2023-11-08T04:23:47.381762Z
Summary
memoffset allows reading uninitialized memory
Details

memoffset allows attempt of reading data from address 0 with arbitrary type. This behavior is an undefined behavior because address 0 to std::mem::size_of<T> may not have valid bit-pattern with T. Old implementation dereferences uninitialized memory obtained from std::mem::align_of. Older implementation prior to it allows using uninitialized data obtained from std::mem::uninitialized with arbitrary type then compute offset by taking the address of field-projection. This may also result in an undefined behavior for "father" that includes (directly or transitively) type that does not allow to be uninitialized.

This flaw was corrected by using std::ptr::addr_of in https://github.com/Gilnaa/memoffset/pull/50.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2023-06-21T22:06:29Z"
}
References

Affected packages

crates.io / memoffset

Package

Affected ranges

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