runes
runes copied to clipboard
Unsound implementation in `load_prefix<T>` and `save_prefix<T>`
trafficstars
https://github.com/Determinant/runes/blob/fd12a0a915ca52e1f65b917feb46f28194328e33/src/utils.rs#L71-L75
Hi, I consider that load_prefix and save_prefix could have unsound implementation. At line 72, users could transmute arbitrary types to byte slice. However, if the types contains padding bytes, consider it as u8 could lead to undefined behavior. Based on the safety part in doc, callers are required to make sure the data points to initialized values while the function here didn't guarantee the safety.
Yes. This project was written a while back when I was picking up Rust. Feel free to submit a PR to fix it and I'll merge it. Thanks!