d4-format icon indicating copy to clipboard operation
d4-format copied to clipboard

misaligned pointer dereference in `read_next_value`

Open shinmao opened this issue 2 years ago • 0 comments

Hi, I found some potential unsoundness in safe method read_next_value: https://github.com/38/d4-format/blob/f8c008732679afa0524863a6d4890be0c96dc0f0/d4/src/ssio/view.rs#L177-L185 In line 184, the code will transmute type of &u8 to &u32 which will create a misaligned pointer, and the pointer is dereferenced in line 185 which will lead to undefined behavior. Is there any test function for read_next_value?

shinmao avatar Jun 19 '23 22:06 shinmao