From c4007c3abea9c8494bf32181a1352b5366bede69 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 30 Aug 2014 19:25:21 +0200 Subject: Bug 735499 - [PATCH] Fix potential modulo by zero in src/template.cpp --- src/template.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/template.cpp b/src/template.cpp index ec8554b..cec2e3c 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -1319,7 +1319,15 @@ class FilterDivisibleBy } if (v.type()==TemplateVariant::Integer && n.type()==TemplateVariant::Integer) { - return TemplateVariant((v.toInt()%n.toInt())==0); + int ni = n.toInt(); + if (ni>0) + { + return TemplateVariant((v.toInt()%ni)==0); + } + else + { + return TemplateVariant(FALSE); + } } else { -- cgit v0.12