VDB
Sign up
MEDIUM

GHSA-wm8x-php5-hvq6

Maligned causes incorrect deallocation

Details

`maligned::align_first` manually allocates with an alignment larger than T, and then uses `Vec::from_raw_parts` on that allocation to get a `Vec<T>`.

[`GlobalAlloc::dealloc`](https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html#tymethod.dealloc) requires that the `layout` argument must be the same layout that was used to allocate that block of memory.

When deallocating, `Box` and `Vec` may not respect the specified alignment and can cause undefined behavior.

Are you affected?

Enter the version of the package you're using.

Affected packages

crates.io/maligned
Introduced in: 0

No fixed version published yet for maligned. Pin to a known-safe version or switch to an alternative.

References