hannobraun / inotify-rs

Idiomatic inotify wrapper for the Rust programming language
ISC License
254 stars 65 forks source link

Unsoudness: reference misalignement #155

Closed a1phyr closed 3 years ago

a1phyr commented 3 years ago

Currently, events are read from a &mut [u8] buffer, which has an alignment of 1, whereas struct inotify_event has an alignement of 4.

Therefore, creating a &inotify_event from such a &[u8] (as done here) may create a misaligned reference, which is undefined behaviour.

hannobraun commented 3 years ago

Thank you for pointing this out, @a1phyr!

hannobraun commented 3 years ago

Presumably fixed by #171, so I'm going to close. Please note that the fix might not be optimal, and any work on trying to provide a more robust fix would be very appreciated. Please check out this comment for more information.