Skip to content

FixedSizeBlock::interpret should either check alignment or use read_unaligned #198

@afranchuk

Description

@afranchuk

read is used here:

let block = unsafe { block_ptr.read() }.from_le();

However the alignment hasn't been verified prior to this. It so happens that FixedSizeBlock is (currently) only implemented on repr(packed) structs (which have 1-byte alignment), however the alignment should still be verified or read_unaligned should be used.

If these should always be repr(packed), maybe add an assert_eq!(std::mem::align_of::<Self>(), 1)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    fix mergedFix is merged, but the issue will stay open until it's released.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions