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.)
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