Closed yotamofek closed 2 years ago
Can you pin where there transmute are I didn't find them.
Here's one example:
https://github.com/rust-pcap/pcap/blob/bc8a3c0cbb8bcf4365fd959b9c79b0729fd79482/src/lib.rs#L1392
It's not a std::mem::transmute
, rather a pointer cast, but the structs still need to be transparent for it to be safe :)
A lot of the code assumes that
BpfInstruction
andBpfProgram
have the same size and layout as their raw counterparts, but they have to have arepr(transparent)
for that to be safe.The nomicon says: