Skip to content

Unsoundness in dispatch2 #752

Open
Open
@anayw2001

Description

@anayw2001

During a soundness audit for the unsafe code in dispatch2, we noticed a potential soundness issue where dyn Fn() -> u8 was being transmuted to dyn Fn() -> bool here. This is unsound because of the potential for vtable layout differences between the two types of functions, so even though the bits are copied when transmuting, the memory layout could be unexpected and therefore lead to corruption (ABI incompatibility between u8 and bool). Additionally, if calling convention somehow differs between the two types of functions, this could also lead to issues with memory corruption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dispatch2Affects the `dispatch2` crateI-unsoundA soundness holequestionFurther information is requested

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions