Explorar el Código

ncd: Fix crash with num_multiply(..., "0").

Ambroz Bizjak hace 11 años
padre
commit
f4500da972
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      ncd/modules/arithmetic.c

+ 1 - 1
ncd/modules/arithmetic.c

@@ -144,7 +144,7 @@ static int compute_subtract (NCDModuleInst *i, uintmax_t n1, uintmax_t n2, uintm
 
 static int compute_multiply (NCDModuleInst *i, uintmax_t n1, uintmax_t n2, uintmax_t *out)
 {
-    if (n1 > UINTMAX_MAX / n2) {
+    if (n2 != 0 && n1 > UINTMAX_MAX / n2) {
         ModuleLog(i, BLOG_ERROR, "multiplication overflow");
         return 0;
     }