Skip to content

offset_of is unsound #1415

Closed
Closed
@RalfJung

Description

@RalfJung

The macro at

macro_rules! offset_of {
is unsound and causes UB due to using * on a NULL pointer. See the reference for details.

The memoffset crate provides a version of this macro that avoids UB (on older versions of rustc, this is not always possible, so it falls back to the 'least incorrect' version when needed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions