summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Chen <ddchen@apple.com>2022-04-19 01:38:36 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-04-19 01:38:36 +0000
commite39fa6cc283ddc1993958b20bafc70a325728a94 (patch)
tree8a9036f98832ef2c78d4698c2945cfe189765050
parent547ff22cf228aacb05935378b9164e9fc8d4b51f (diff)
parent7c90e7b850b6931aae87883760ec42c36c6f0014 (diff)
downloadscudo-e39fa6cc283ddc1993958b20bafc70a325728a94.tar.gz
[scudo] Use cast on calls to __builtin_umul_overflow/__builtin_umull_overflow am: 82ea5b5cf6 am: 3178c334e1 am: 53405cc640 am: 7c90e7b850
Original change: https://android-review.googlesource.com/c/platform/external/scudo/+/2063220 Change-Id: I4f246c4e231e627a64bea8f47be17e2aaaba2068 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)