From b2239f04bab2f82eca24eb9d56897416cc2ce20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 28 Sep 2019 11:03:20 +0200 Subject: [PATCH] ExprEngine: Improve 'division by zero' warning --- lib/exprengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 9a7fc3bba..770a00ff7 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -1017,7 +1017,7 @@ void ExprEngine::executeAllFunctions(const Tokenizer *tokenizer, const Settings } catch (const std::exception &e) { // FIXME.. there should not be exceptions std::string functionName = functionScope->function->name(); - std::cout << "Verify: Aborted analysis of function '" << functionName << "': " << e.what(); + std::cout << "Verify: Aborted analysis of function '" << functionName << "': " << e.what() << std::endl; } } } @@ -1113,7 +1113,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer, return; if (tok->astParent()->astOperand2() == tok && value.isIntValueInRange(0)) { std::list callstack{tok->astParent()}; - ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationDivByZero", "Division by zero", false); + ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationDivByZero", "There is division, cannot determine that there can't be a division by zero.", CWE(369), false); errorLogger->reportErr(errmsg); } };