Skip to content

Soundness: Reads from padding bytes of unions in generated Debug impl #45

@Manishearth

Description

@Manishearth

let size = ::core::mem::size_of::<Self>();
let data = unsafe { ::core::slice::from_raw_parts(self as *const Self as *const u8, size) };
builder.field(&data);
builder.finish()

This is unsound: there is no guarantee those bytes are readable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions