Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -597,6 +597,11 @@ #define _LIBCPP_HAS_NO_ASAN +// Allow for build-time disabling of unsigned integer sanitization +#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute((no_sanitize("unsigned integer"))) +#endif + #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__ #ifndef _LIBCPP_HAS_NO_NOEXCEPT @@ -826,6 +831,10 @@ #define _LIBCPP_HAS_NO_ATOMIC_HEADER #endif +#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +#endif + #endif // __cplusplus #endif // _LIBCPP_CONFIG Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -3194,7 +3194,7 @@ // murmur2 template _Size -__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) +_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) { const _Size __m = 0x5bd1e995; const _Size __r = 24; @@ -3344,7 +3344,7 @@ // cityhash64 template _Size -__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) +_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) { const char* __s = static_cast(__key); if (__len <= 32) {