kblomdahl/dream-go

Unsound uninitialized array

shinmao opened this issue · 0 comments

Hi I found some unsound use of MaybeUninit which might lead to UB.

https://github.com/Chicoryn/dream-go/blob/8ace1f228e06b4d908a64f3a04f9195392951bdb/src/libdg_mcts/asm/sum_finite.rs#L54

It is UB to have an uninitialized f32. I think the code should be changed to:

let mut out: [MaybeUninit<f32>; 8] = ...MaybeUninit::uninit().assume_init();

Same issue happens on i32.