mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-12 10:52:38 +00:00
[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
This commit is contained in:
parent
7dda44c189
commit
9343fc7613
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user