Skip to content

atty potential unaligned read #1457

Closed
Closed
@niluxv

Description

@niluxv

I found some discussions on a potential unaligned read in atty (10,564,450 recent downloads; 3 years since the last release). I think it legitimately looks like a soundness bug (though I guess it won't cause issues with the usual global allocators?). The issue was filed more than a year ago.

If I understand correctly, FILE_NAME_INFO boils down to a struct like

#[repr(C)]
struct FILE_NAME_INFO {
    FileNameLength: u32,
    FileName: [u16; 1],
}

which has align 4 (playground). The vector name_info_bytes in https://github.com/softprops/atty/blob/7b5df17888997d57c2c1c8f91da1db5691f49953/src/lib.rs#L131-L141 need not be 4 byte aligned (though with any sane allocator it will be?).

Links:

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