summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Chen <ddchen@apple.com>2022-04-19 01:05:20 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-19 01:05:20 +0000
commit7c90e7b850b6931aae87883760ec42c36c6f0014 (patch)
tree8a9036f98832ef2c78d4698c2945cfe189765050
parente12860bd159e767a007da7371f69a2dc245b0366 (diff)
parent53405cc640b28cac9bcda4b80defea1b084c1d81 (diff)
downloadscudo-7c90e7b850b6931aae87883760ec42c36c6f0014.tar.gz
[scudo] Use cast on calls to __builtin_umul_overflow/__builtin_umull_overflow am: 82ea5b5cf6 am: 3178c334e1 am: 53405cc640
Original change: https://android-review.googlesource.com/c/platform/external/scudo/+/2063220 Change-Id: If52c5c253c84237d62fd251c6ee981518c8d4e8a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--standalone/wrappers_c_checks.h7
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)