hannobraun / inotify-rs

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

Allow unaligned buffers #198

Closed talklittle closed 2 years ago

talklittle commented 2 years ago

The key is using std::ptr::read_unaligned to read a struct from an unaligned pointer, instead of the * operator to dereference it. read_unaligned() permits unaligned pointers, whereas * leads to undefined behavior.

Adds a CI test to run Miri on the affected code and detect alignment bugs. (Miri cannot be run on all tests, as it cannot make FFI calls for example.)

Fixes #174