]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Avoid divide by 0 exception
authorKelvin Lee <kiyolee@gmail.com>
Fri, 30 Sep 2022 08:26:37 +0000 (18:26 +1000)
committerPauli <pauli@openssl.org>
Sun, 2 Oct 2022 09:41:34 +0000 (20:41 +1100)
CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19310)

include/internal/safe_math.h

index 9a20957eb6585c720ea4ded2201f8261222b85ec..be37e6ab882ed746f4fa9d854337a9b002f2b3d5 100644 (file)
                                                                type b,       \
                                                                int *err)     \
     {                                                                        \
-        if (a > max / b)                                                     \
+        if (b != 0 && a > max / b)                                           \
             *err |= 1;                                                       \
         return a * b;                                                        \
     }