# RUSTSEC-2026-0598: hugepage\_rs::alloc may cause undefined behavior with zero-sized layouts from safe code

- Database: RustSec
- Published: 2026-10-27
- Modified: 2026-11-24

## Affected versions

- hugepage-rs (crates.io): fixed in 0.1.2

## Description

`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.
`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`.
Affected versions therefore exposed an unsafe allocation precondition through safe Rust code, violating Rust's soundness guarantees.

The upstream repository fixed this in version `0.1.2` by marking `alloc` as unsafe and documenting its non-zero-layout requirement.

## References

- https://crates.io/crates/hugepage-rs
- https://rustsec.org/advisories/RUSTSEC-2026-0598.html
- https://github.com/cppcoffee/hugepage-rs/issues/7
- https://github.com/cppcoffee/hugepage-rs/pull/8
- https://github.com/cppcoffee/hugepage-rs/releases/tag/v0.1.2

Page: https://cve.now/RUSTSEC-2026-0598

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
