Files
woff2/src
David Benjamin 23a34adec3 Fix undefined type-punning when loading/storing words
Despite common practice, type-punning integer types out of buffers is
undefined in C and C++. It's both a strict aliasing violation on access,
and if the pointer isn't aligned, an alignment violation on cast. Being
undefined, the compiler is allowed to arbitrarily miscompile the code
when we rely on it.

Instead, the two legal ways to pull a uint32_t out of a buffer are to
either use memcpy, or load byte by byte and use shifts. In both cases,
a good compiler should be smart enough to recognize what we're doing and
generate reasonable code. Since there was already fallback code for the
latter (for a middle-endian architecture?), I went ahead and switched to
that.

This change is needed to fix UBSan violations in Chromium.
2023-10-26 10:16:05 -04:00
..
2017-10-04 16:12:46 -07:00
2017-10-13 13:12:55 -07:00
2017-10-04 16:12:46 -07:00
2017-10-13 13:12:55 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00
2017-10-04 16:12:46 -07:00