Maligned causes incorrect deallocation
Moderate severity
GitHub Reviewed
Published
Mar 7, 2023
to the GitHub Advisory Database
•
Updated Mar 7, 2023
Description
Published to the GitHub Advisory Database
Mar 7, 2023
Reviewed
Mar 7, 2023
Last updated
Mar 7, 2023
maligned::align_firstmanually allocates with an alignment larger than T, and then usesVec::from_raw_partson that allocation to get aVec<T>.GlobalAlloc::deallocrequires that thelayoutargument must be the same layout that was used to allocate that block of memory.When deallocating,
BoxandVecmay not respect the specified alignment and can cause undefined behavior.References