Skip to content

fill_alignment_gap potentially produces UB #1272

Open
@playX18

Description

@playX18

In the function here: https://github.com/mmtk/mmtk-core/blob/master/src/util/alloc/allocator.rs#L90 the assumption is that ALIGNMENT_VALUE fits into BYTES_IN_INT, but BYTES_IN_INT is 4 everywhere while ALIGNMENT_VALUE is defined as usize. On top of that it does store(usize) so it will write 8 bytes on 64-bit targets even if ALIGNMENT_VALUE fits into 32 bits.

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