dsp.h: add WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW

for suppressing expected failures with -fsanitize=integer

Change-Id: I954cba45f0c96478b770ed7a6ac7491359cae075
This commit is contained in:
James Zern 2016-05-12 23:51:23 -07:00
parent af81fdb772
commit e53c9ccb24

View File

@ -105,16 +105,24 @@ extern "C" {
#endif #endif
#endif #endif
// This macro prevents the undefined behavior sanitizer from reporting
// failures. This is only meant to silence unaligned loads on platforms that
// are known to support them.
#define WEBP_UBSAN_IGNORE_UNDEF #define WEBP_UBSAN_IGNORE_UNDEF
#define WEBP_UBSAN_IGNORE_UNSIGNED_OVERFLOW
#if !defined(WEBP_FORCE_ALIGNED) && defined(__clang__) && \ #if !defined(WEBP_FORCE_ALIGNED) && defined(__clang__) && \
defined(__has_attribute) defined(__has_attribute)
#if __has_attribute(no_sanitize) #if __has_attribute(no_sanitize)
// This macro prevents the undefined behavior sanitizer from reporting
// failures. This is only meant to silence unaligned loads on platforms that
// are known to support them.
#undef WEBP_UBSAN_IGNORE_UNDEF #undef WEBP_UBSAN_IGNORE_UNDEF
#define WEBP_UBSAN_IGNORE_UNDEF \ #define WEBP_UBSAN_IGNORE_UNDEF \
__attribute__((no_sanitize("undefined"))) __attribute__((no_sanitize("undefined")))
// This macro prevents the undefined behavior sanitizer from reporting
// failures related to unsigned integer overflows. This is only meant to
// silence cases where this well defined behavior is expected.
#undef WEBP_UBSAN_IGNORE_UNDEF
#define WEBP_UBSAN_IGNORE_UNDEF \
__attribute__((no_sanitize("unsigned-integer-overflow")))
#endif #endif
#endif #endif