{"id":"RUSTSEC-2026-0598","summary":"`hugepage_rs::alloc` may cause undefined behavior with zero-sized layouts from safe code","details":"`hugepage_rs::alloc` was a publicly accessible safe function that forwarded a `Layout` to the hugepage allocator's `GlobalAlloc::alloc` implementation without enforcing its safety requirements.\n`GlobalAlloc::alloc` requires the layout size to be non-zero. However, the safe wrapper allowed callers to pass a zero-sized `Layout`, violating this precondition without using `unsafe`.\nAffected versions therefore exposed an unsafe allocation precondition through safe Rust code, violating Rust's soundness guarantees.\n\nThe upstream repository fixed this in version `0.1.2` by marking `alloc` as unsafe and documenting its non-zero-layout requirement.","modified":"2026-11-24T09:30:02.332816519Z","published":"2026-10-27T12:00:00Z","database_specific":{"license":"CC0-1.0"},"references":[{"type":"PACKAGE","url":"https://crates.io/crates/hugepage-rs"},{"type":"ADVISORY","url":"https://rustsec.org/advisories/RUSTSEC-2026-0598.html"},{"type":"REPORT","url":"https://github.com/cppcoffee/hugepage-rs/issues/7"},{"type":"WEB","url":"https://github.com/cppcoffee/hugepage-rs/pull/8"},{"type":"WEB","url":"https://github.com/cppcoffee/hugepage-rs/releases/tag/v0.1.2"}],"affected":[{"package":{"name":"hugepage-rs","ecosystem":"crates.io","purl":"pkg:cargo/hugepage-rs"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.1.2"}]}],"ecosystem_specific":{"affects":{"os":[],"functions":["hugepage_rs::alloc"],"arch":[]},"affected_functions":null},"database_specific":{"categories":[],"cvss":null,"informational":"unsound","source":"https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0598.json"}}],"schema_version":"1.9.2"}