|
match reader.read(unsafe { |
|
from_raw_parts_mut(transmute::<*mut T, *mut u8>(obj as *mut T), len) |
|
}) { |
|
Some(x) => x == len, |
|
None => false, |
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.
runes/src/utils.rs
Lines 71 to 75 in fd12a0a
Hi, I consider that
load_prefixandsave_prefixcould have unsound implementation. At line 72, users could transmute arbitrary types to byte slice. However, if the types contains padding bytes, consider it asu8could 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.