# GHSA-wm8x-php5-hvq6: Maligned causes incorrect deallocation

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2023-03-04T12:00:00.000Z
- Modified: 2023-11-08T04:23:53.984Z
- Also known as: RUSTSEC-2023-0017

## Description

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

(As written by GitHub Advisory Database.)

## Affected

- maligned (crates.io): up to 0.2.1; from 0.0.0-0

## References

- <https://github.com/tylerhawkes/maligned/issues/5> (report, web)
- <https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html#tymethod.dealloc> (web)
- <https://github.com/tylerhawkes/maligned> (package)
- <https://rustsec.org/advisories/RUSTSEC-2023-0017.html> (advisory, web)
- <https://crates.io/crates/maligned> (package)

## Sources

- GitHub Advisory Database: [GHSA-wm8x-php5-hvq6](https://github.com/advisories/GHSA-wm8x-php5-hvq6), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2023-0017](https://rustsec.org/advisories/RUSTSEC-2023-0017.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-wm8x-php5-hvq6 · Whole record: https://cve.day/GHSA-wm8x-php5-hvq6.json · Rebuilt by cve.day 2026-11-25T22:56:43.141Z
