ExprEngine: Improve 'division by zero' warning

This commit is contained in:
Daniel Marjamäki 2019-09-28 11:03:20 +02:00
parent 0de3e76b2d
commit b2239f04ba
1 changed files with 2 additions and 2 deletions

View File

@ -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<const Token*> 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);
}
};