This ports the change from libvpx to fix ubsan warnings. Change-Id: I7e0a0ca2508606bba9dd2570b8a6b4e30f84f9e0