diff options
author | Dominic Chen <ddchen@apple.com> | 2022-03-16 13:40:58 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2022-04-18 13:40:30 -0700 |
commit | 82ea5b5cf6173fca7085be9c7447c7bf3850e5d0 (patch) | |
tree | 8a9036f98832ef2c78d4698c2945cfe189765050 | |
parent | 6bb3118929f9592a7bfcb1032e5b667a86cd5a74 (diff) | |
download | scudo-82ea5b5cf6173fca7085be9c7447c7bf3850e5d0.tar.gz |
[scudo] Use cast on calls to __builtin_umul_overflow/__builtin_umull_overflow
Platforms may define uintptr_t differently, so perform an explicit cast
Differential Revision: https://reviews.llvm.org/D121852
GitOrigin-RevId: 9343fc76133bfdd0e4003e58403a79b140ec1b25
Change-Id: Ia586cba305a28128b2ed9aa16b96dbb1f8f18b5c
-rw-r--r-- | standalone/wrappers_c_checks.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/standalone/wrappers_c_checks.h b/standalone/wrappers_c_checks.h index ec9c1a104e8..815d40023b6 100644 --- a/standalone/wrappers_c_checks.h +++ b/standalone/wrappers_c_checks.h @@ -47,9 +47,12 @@ inline bool checkPosixMemalignAlignment(uptr Alignment) { // costly division. inline bool checkForCallocOverflow(uptr Size, uptr N, uptr *Product) { #if __has_builtin(__builtin_umull_overflow) && (SCUDO_WORDSIZE == 64U) - return __builtin_umull_overflow(Size, N, Product); + return __builtin_umull_overflow(Size, N, + reinterpret_cast<unsigned long *>(Product)); #elif __has_builtin(__builtin_umul_overflow) && (SCUDO_WORDSIZE == 32U) - return __builtin_umul_overflow(Size, N, Product); + // On, e.g. armv7, uptr/uintptr_t may be defined as unsigned long + return __builtin_umul_overflow(Size, N, + reinterpret_cast<unsigned int *>(Product)); #else *Product = Size * N; if (!Size) |