Skip to content

maligned::align_first is unsound #1209

@kyrias

Description

@kyrias

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

As per the stdlib documentation this violates the GlobalAlloc::dealloc safety contract and causes undefined behaviour, since the allocation has to have the exact same allocation as T.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UnmaintainedInformational / UnmaintainedUnsoundInformational / Unsound

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions