So I went on a bit of a journey in the #219 issue.
In conclusion, the address returned by ffi::lua_newuserdata() might be unaligned, which causes dereferencing actual_typeid to segfault due to a potential unaligned pointer. Changing it to allow for unaligned reads, results in all tests and all examples succeeding without segfaulting.
I'm unsure if the subsequent *data can ever be unaligned. But I didn't run into it so far.
Fixed #219.
So I went on a bit of a journey in the #219 issue.
In conclusion, the address returned by
ffi::lua_newuserdata()
might be unaligned, which causes dereferencingactual_typeid
to segfault due to a potential unaligned pointer. Changing it to allow for unaligned reads, results in all tests and all examples succeeding without segfaulting.I'm unsure if the subsequent
*data
can ever be unaligned. But I didn't run into it so far.