Skip to content

Misaligned reference constructed by ControlMessage::ScmTimestamp #999

Closed
@Ralith

Description

@Ralith

On macOS (and maybe other systems?) cmsg data is 4-byte aligned. In 64-bit macOS environments, libc::timeval contains 8-byte values, and is presumably 8-byte aligned. ControlMessage directly converts the pointer to the cmsg data into a typed reference, which is therefore apparently unaligned and incurs UB. It seems like the only safe thing to do here would be to use ptr::read_unaligned.

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