Open shinmao opened 1 year ago
https://github.com/mozilla/grcov/blob/322fc39acacd75aca0ff1c0a1ec2a3e91f04011c/src/reader.rs#L169-L177 Hi, I am interested in the way you guarantee the safety of alignment issues. Take read_u32 for example, we are worried that the data is aligned to 1 byte rather than 4 bytes here. Do you use the offset starting from 4 bytes with buffer[start..] to solve the issue?
read_u32
buffer[start..]
In other words, if we use transmute($buf.buffer.as_ptr()), then it is still dangerous?
transmute($buf.buffer.as_ptr())
https://github.com/mozilla/grcov/blob/322fc39acacd75aca0ff1c0a1ec2a3e91f04011c/src/reader.rs#L169-L177 Hi, I am interested in the way you guarantee the safety of alignment issues. Take
read_u32
for example, we are worried that the data is aligned to 1 byte rather than 4 bytes here. Do you use the offset starting from 4 bytes withbuffer[start..]
to solve the issue?In other words, if we use
transmute($buf.buffer.as_ptr())
, then it is still dangerous?