From 6cd84902fce4ee5606b03d5165a5e1a29f60cb14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Wed, 10 Jul 2019 20:30:28 +0300 Subject: [PATCH] Whoooops --- ethermess.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ethermess.c b/ethermess.c index 0656e89..fe305e2 100644 --- a/ethermess.c +++ b/ethermess.c @@ -200,6 +200,9 @@ intmax_t saturating_sub(intmax_t a, intmax_t b) { intmax_t saturating_mul(intmax_t a, intmax_t b) { // Doesn't give 100% right results when one parameter is INTMAX_MIN, // but at least it won't ever overflow + if (a == 0 || b == 0) { + return 0; + } if (a < 0) { return saturating_sub(0, saturating_mul(saturating_sub(0, a), b)); }