From 9fdbf585f47501ba19a53fd4bb382d5b533e3fdd Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 6 Nov 2026 09:39:42 +0100 Subject: bplist: Guard uint64_mul_overflow fallback against division by zero The portable fallback used when __builtin_umulll_overflow is not available computed a > UINT64_MAX / b, which divides by zero if b is 0. No current caller passes 0, but return no overflow in that case so the helper is safe for any input. --- src/bplist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bplist.c b/src/bplist.c index 0591526..663a118 100644 --- a/src/bplist.c +++ b/src/bplist.c @@ -223,7 +223,7 @@ static uint64_t UINT_TO_HOST(const void* x, uint8_t n) static int uint64_mul_overflow(uint64_t a, uint64_t b, uint64_t *res) { *res = a * b; - return (a > UINT64_MAX / b); + return (b != 0 && a > UINT64_MAX / b); } #endif -- cgit v1.1-32-gdbae