mmtk-core icon indicating copy to clipboard operation
mmtk-core copied to clipboard

fill_alignment_gap potentially produces UB

Open playX18 opened this issue 11 months ago • 0 comments

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.

playX18 avatar Feb 13 '25 09:02 playX18