Merge pull request #195 from ccawley2011/patch-1

Avoid using unaligned memory access in UBSan builds
This commit is contained in:
Martin Raiber 2021-10-03 13:13:13 +02:00 committed by GitHub
commit ca1a779ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -168,6 +168,13 @@
#define MINIZ_LITTLE_ENDIAN 0
#endif
/* Using unaligned loads and stores causes errors when using UBSan */
#if defined(__has_feature)
#if __has_feature(undefined_behavior_sanitizer)
#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 0
#endif
#endif
/* Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES only if not set */
#if !defined(MINIZ_USE_UNALIGNED_LOADS_AND_STORES)
#if MINIZ_X86_OR_X64_CPU