Email me

Rust advisories / memoffset

Unsound MediumRUSTSEC-2023-0045 · memoffset

RUSTSEC-2023-0045: memoffset allows reading uninitialized memory

Short answermemoffset has an API that can cause undefined behaviour from safe code: memoffset allows reading uninitialized memory. Fixed in 0.6.2.

Cratememoffset
TypeUnsound (memory-corruption)
Affected versionsBefore 0.6.2.
Fixed in0.6.2
SeverityMedium (GitHub rating)
Published2023-06-21
Last changed2023-11-08
Also known asGHSA-wfg4-322g-9vqv
Affected functionsmemoffset::offset_of

What to do

  1. See which version you have: cargo tree -i memoffset (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p memoffset. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example memoffset = "0.6.2") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

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>.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for memoffset

Full security history of memoffset

Up next

Same cratememoffset: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ