Преглед изворни кода

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

Ambroz Bizjak пре 11 година
родитељ
комит
f4500da972
1 измењених фајлова са 1 додато и 1 уклоњено
  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;
     }