{"id":"GHSA-wfg4-322g-9vqv","aliases":["GHSA-wfg4-322g-9vqv","RUSTSEC-2023-0045"],"related":[],"kind":"vulnerability","state":"published","title":"memoffset allows reading uninitialized memory","summary":"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](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html).\n\nThis flaw was corrected by using `std::ptr::addr_of` in <https://github.com/Gilnaa/memoffset/pull/50>.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"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](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html).\n\nThis flaw was corrected by using `std::ptr::addr_of` in <https://github.com/Gilnaa/memoffset/pull/50>.","format":"markdown","source":"ghsa"}],"published":"2023-06-21T12:00:00.000Z","modified":"2023-11-08T04:23:47.381Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.6.2"}],"ecosystem":"crates.io","package":"memoffset","purl":"pkg:cargo/memoffset","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.6.2"}],"ecosystem":"crates.io","package":"memoffset","purl":"pkg:cargo/memoffset","source":"rustsec"}],"references":[{"url":"https://github.com/Gilnaa/memoffset/issues/24","tags":["report","web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/Gilnaa/memoffset/pull/50","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/Gilnaa/memoffset","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2023-0045.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/memoffset","tags":["package"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wfg4-322g-9vqv","url":"https://github.com/advisories/GHSA-wfg4-322g-9vqv","licence":"CC-BY-4.0","modified":"2023-11-08T04:23:47.381Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2023-0045","url":"https://rustsec.org/advisories/RUSTSEC-2023-0045.html","licence":"CC0-1.0","modified":"2023-11-08T04:23:47.381Z"}],"updatedAt":"2026-11-25T22:56:43.150Z"}