From 3936afcca99f716cc63928fbebd0271a51ed3046 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 15 Jan 2023 01:48:45 +0100 Subject: [PATCH] cppcheck divide by zero --- tools/cryptorf/sma_multi.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/cryptorf/sma_multi.cpp b/tools/cryptorf/sma_multi.cpp index f7047d977..c4e61e37e 100644 --- a/tools/cryptorf/sma_multi.cpp +++ b/tools/cryptorf/sma_multi.cpp @@ -165,6 +165,9 @@ void print_cs(const char *text, pcs s) { } static inline uint8_t mod(uint8_t a, uint8_t m) { + if (m==0) { + return 0; // Actually, divide by zero error + } // Just return the input when this is less or equal than the modular value if (a < m) return a;