The overflow check mul_overflows_s64(int64_t, int64_t) overflows and triggers UB :-) Remove it

The overflow check `mul_overflows_s64(int64_t, int64_t)` overflows.
Since this is an signed integer overflow this triggers UB, which
in turn means that we cannot trust the check.

Luckily mul_overflows_s64(int64_t, int64_t) is unused. Removing it.
This commit is contained in:
practicalswift 2018-03-27 19:15:26 +02:00 committed by Rusty Russell
parent f2e81fde44
commit 8df29d169c
1 changed files with 0 additions and 10 deletions

View File

@ -12,16 +12,6 @@ static inline bool add_overflows_u64(uint64_t a, uint64_t b)
return (a + b) < a;
}
static inline bool mul_overflows_s64(int64_t a, int64_t b)
{
int64_t ret;
if (a == 0)
return false;
ret = a * b;
return (ret / a != b);
}
static inline bool mul_overflows_u64(uint64_t a, uint64_t b)
{
uint64_t ret;