From 3189e12733e676fbbc30b1b2d98952a6a9f78073 Mon Sep 17 00:00:00 2001 From: Kelvin Lee Date: Fri, 30 Sep 2022 18:26:37 +1000 Subject: [PATCH] Avoid divide by 0 exception CLA: trivial Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/19310) --- include/internal/safe_math.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/safe_math.h b/include/internal/safe_math.h index 9a20957eb6..be37e6ab88 100644 --- a/include/internal/safe_math.h +++ b/include/internal/safe_math.h @@ -183,7 +183,7 @@ type b, \ int *err) \ { \ - if (a > max / b) \ + if (b != 0 && a > max / b) \ *err |= 1; \ return a * b; \ }