Fixes a -Wcast-align warning and a -fsanitize=undefined error. https://bugs.freedesktop.org/show_bug.cgi?id=71079