diff options
| author | 2026-11-06 09:39:42 +0100 | |
|---|---|---|
| committer | 2026-11-06 09:39:42 +0100 | |
| commit | 9fdbf585f47501ba19a53fd4bb382d5b533e3fdd (patch) | |
| tree | 021112e47dbe5d3af6a4f5808c8a752dd6b96083 /src | |
| parent | 70a64c23c9d77b114dcc71e70e69aa8868693f3f (diff) | |
| download | libplist-9fdbf585f47501ba19a53fd4bb382d5b533e3fdd.tar.gz libplist-9fdbf585f47501ba19a53fd4bb382d5b533e3fdd.tar.bz2 | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bplist.c | 2 |
1 files changed, 1 insertions, 1 deletions
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 |
