Advisory

RUSTSEC-2023-0045

Also known as: GHSA-wfg4-322g-9vqv

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.

Severity

Not rated by the source.

Dates

Published
2023-06-21 12:00 UTC
Modified
2023-11-08 04:23 UTC

Affected packages and fixes

memoffset

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.6.2 (semver)

Fixed versions

0.6.2

Fix

  • Fixed version 0.6.2
    cargo update -p memoffset --precise 0.6.2

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences