TimelyDataflow / abomonation

A mortifying serialization library for Rust
MIT License
317 stars 30 forks source link

Sanitize addresses in serialized data. #8

Open frankmcsherry opened 6 years ago

frankmcsherry commented 6 years ago

As of 0.5 Abomonation doesn't automatically sanitize addresses in serialized data. This is mainly due to requiring random access to the post-serialized data, which means (roughly) a &mut [u8] interface to the written data, and not all W: Write provide this.

Instead, we could add back something like

pub fn sanitize<T: Abomonation>(bytes: &mut [u8])

which would treat bytes as a &T and erase the associated memory-address holding fields.

I'm not 100% certain what the right way to erase the fields is, as the packing of exciting discriminant information into such fields is recent sport for the Rust folks. It could just be pushing a 0x01 in there (what is used to be), but this could change at a moment's notice, I would guess.