Rename Verification => Bughunting
This commit is contained in:
parent
103532bb03
commit
f7a30fc99f
|
@ -1091,7 +1091,7 @@ void CppCheckExecutor::reportErr(const ErrorLogger::ErrorMessage &msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppCheckExecutor::reportVerification(const std::string &str)
|
void CppCheckExecutor::bughuntingReport(const std::string &str)
|
||||||
{
|
{
|
||||||
if (!mSettings || str.empty())
|
if (!mSettings || str.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void reportInfo(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
void reportInfo(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
||||||
|
|
||||||
void reportVerification(const std::string &str) OVERRIDE;
|
void bughuntingReport(const std::string &str) OVERRIDE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Information about how many files have been checked
|
* Information about how many files have been checked
|
||||||
|
|
|
@ -348,7 +348,7 @@ void ThreadExecutor::reportInfo(const ErrorLogger::ErrorMessage &msg)
|
||||||
writeToPipe(REPORT_INFO, msg.serialize());
|
writeToPipe(REPORT_INFO, msg.serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadExecutor::reportVerification(const std::string &str)
|
void ThreadExecutor::bughuntingReport(const std::string &str)
|
||||||
{
|
{
|
||||||
writeToPipe(REPORT_VERIFICATION, str.c_str());
|
writeToPipe(REPORT_VERIFICATION, str.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
void reportOut(const std::string &outmsg) OVERRIDE;
|
void reportOut(const std::string &outmsg) OVERRIDE;
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
||||||
void reportInfo(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
void reportInfo(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
||||||
void reportVerification(const std::string &str) OVERRIDE;
|
void bughuntingReport(const std::string &str) OVERRIDE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add content to a file, to be used in unit testing.
|
* @brief Add content to a file, to be used in unit testing.
|
||||||
|
|
|
@ -16,7 +16,7 @@ NewSuppressionDialog::NewSuppressionDialog(QWidget *parent) :
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg) override {
|
void reportErr(const ErrorLogger::ErrorMessage &msg) override {
|
||||||
errorIds << QString::fromStdString(msg.id);
|
errorIds << QString::fromStdString(msg.id);
|
||||||
}
|
}
|
||||||
void reportVerification(const std::string &/*str*/) override {}
|
void bughuntingReport(const std::string &/*str*/) override {}
|
||||||
QStringList errorIds;
|
QStringList errorIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void reportOut(const std::string &outmsg) override;
|
void reportOut(const std::string &outmsg) override;
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg) override;
|
void reportErr(const ErrorLogger::ErrorMessage &msg) override;
|
||||||
void reportVerification(const std::string &/*str*/) override {}
|
void bughuntingReport(const std::string &/*str*/) override {}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|
|
@ -1286,9 +1286,9 @@ void CppCheck::reportStatus(unsigned int /*fileindex*/, unsigned int /*filecount
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppCheck::reportVerification(const std::string &str)
|
void CppCheck::bughuntingReport(const std::string &str)
|
||||||
{
|
{
|
||||||
mErrorLogger.reportVerification(str);
|
mErrorLogger.bughuntingReport(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppCheck::getErrorMessages()
|
void CppCheck::getErrorMessages()
|
||||||
|
|
|
@ -195,7 +195,7 @@ private:
|
||||||
*/
|
*/
|
||||||
void reportOut(const std::string &outmsg) OVERRIDE;
|
void reportOut(const std::string &outmsg) OVERRIDE;
|
||||||
|
|
||||||
void reportVerification(const std::string &str) OVERRIDE;
|
void bughuntingReport(const std::string &str) OVERRIDE;
|
||||||
|
|
||||||
std::list<std::string> mErrorList;
|
std::list<std::string> mErrorList;
|
||||||
Settings mSettings;
|
Settings mSettings;
|
||||||
|
|
|
@ -407,7 +407,7 @@ public:
|
||||||
reportErr(msg);
|
reportErr(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void reportVerification(const std::string &str) = 0;
|
virtual void bughuntingReport(const std::string &str) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report unmatched suppressions
|
* Report unmatched suppressions
|
||||||
|
|
|
@ -1794,7 +1794,7 @@ void ExprEngine::executeFunction(const Scope *functionScope, const Tokenizer *to
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write a verification report
|
// Write a report
|
||||||
if (bugHuntingReport) {
|
if (bugHuntingReport) {
|
||||||
report << "[function-report] "
|
report << "[function-report] "
|
||||||
<< Path::stripDirectoryPart(tokenizer->list.getFiles().at(functionScope->bodyStart->fileIndex())) << ":"
|
<< Path::stripDirectoryPart(tokenizer->list.getFiles().at(functionScope->bodyStart->fileIndex())) << ":"
|
||||||
|
@ -1827,7 +1827,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
if (tok->astParent()->astOperand2() == tok && value.isEqual(dataBase, 0)) {
|
if (tok->astParent()->astOperand2() == tok && value.isEqual(dataBase, 0)) {
|
||||||
dataBase->addError(tok->linenr());
|
dataBase->addError(tok->linenr());
|
||||||
std::list<const Token*> callstack{tok->astParent()};
|
std::list<const Token*> callstack{tok->astParent()};
|
||||||
const char * const id = (tok->valueType() && tok->valueType()->isFloat()) ? "verificationDivByZeroFloat" : "verificationDivByZero";
|
const char * const id = (tok->valueType() && tok->valueType()->isFloat()) ? "bughuntingDivByZeroFloat" : "bughuntingDivByZero";
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, id, "There is division, cannot determine that there can't be a division by zero.", CWE(369), false);
|
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, id, "There is division, cannot determine that there can't be a division by zero.", CWE(369), false);
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
}
|
}
|
||||||
|
@ -1877,7 +1877,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
errorMessage += " Note that unsigned integer overflow is defined and will wrap around.";
|
errorMessage += " Note that unsigned integer overflow is defined and will wrap around.";
|
||||||
|
|
||||||
std::list<const Token*> callstack{tok};
|
std::list<const Token*> callstack{tok};
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationIntegerOverflow", errorMessage, false);
|
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingIntegerOverflow", errorMessage, false);
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1943,7 +1943,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
|
|
||||||
dataBase->addError(tok->linenr());
|
dataBase->addError(tok->linenr());
|
||||||
std::list<const Token*> callstack{tok};
|
std::list<const Token*> callstack{tok};
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationUninit", "Cannot determine that '" + tok->expressionString() + "' is initialized", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
|
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingUninit", "Cannot determine that '" + tok->expressionString() + "' is initialized", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1991,7 +1991,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack,
|
ErrorLogger::ErrorMessage errmsg(callstack,
|
||||||
&tokenizer->list,
|
&tokenizer->list,
|
||||||
Severity::SeverityType::error,
|
Severity::SeverityType::error,
|
||||||
"verificationInvalidArgValue",
|
"bughuntingInvalidArgValue",
|
||||||
"There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value meets the attribute " + bad, CWE(0), false);
|
"There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value meets the attribute " + bad, CWE(0), false);
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
return;
|
return;
|
||||||
|
@ -2040,7 +2040,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
if (err) {
|
if (err) {
|
||||||
dataBase->addError(tok->linenr());
|
dataBase->addError(tok->linenr());
|
||||||
std::list<const Token*> callstack{tok};
|
std::list<const Token*> callstack{tok};
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationInvalidArgValue", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value is valid. Bad value: " + bad, CWE(0), false);
|
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingInvalidArgValue", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument value is valid. Bad value: " + bad, CWE(0), false);
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2055,7 +2055,7 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
if (v.second->isUninit()) {
|
if (v.second->isUninit()) {
|
||||||
dataBase->addError(tok->linenr());
|
dataBase->addError(tok->linenr());
|
||||||
std::list<const Token*> callstack{tok};
|
std::list<const Token*> callstack{tok};
|
||||||
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "verificationUninitArg", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument is initialized.", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
|
ErrorLogger::ErrorMessage errmsg(callstack, &tokenizer->list, Severity::SeverityType::error, "bughuntingUninitArg", "There is function call, cannot determine that " + std::to_string(num) + getOrdinalText(num) + " argument is initialized.", CWE_USE_OF_UNINITIALIZED_VARIABLE, false);
|
||||||
errorLogger->reportErr(errmsg);
|
errorLogger->reportErr(errmsg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2079,5 +2079,5 @@ void ExprEngine::runChecks(ErrorLogger *errorLogger, const Tokenizer *tokenizer,
|
||||||
if (settings->bugHuntingReport.empty())
|
if (settings->bugHuntingReport.empty())
|
||||||
std::cout << report.str();
|
std::cout << report.str();
|
||||||
else if (errorLogger)
|
else if (errorLogger)
|
||||||
errorLogger->reportVerification(report.str());
|
errorLogger->bughuntingReport(report.str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ private:
|
||||||
std::list<std::string> id;
|
std::list<std::string> id;
|
||||||
|
|
||||||
void reportOut(const std::string & /*outmsg*/) OVERRIDE {}
|
void reportOut(const std::string & /*outmsg*/) OVERRIDE {}
|
||||||
void reportVerification(const std::string & /*str*/) OVERRIDE {}
|
void bughuntingReport(const std::string & /*str*/) OVERRIDE {}
|
||||||
|
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE {
|
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE {
|
||||||
id.push_back(msg.id);
|
id.push_back(msg.id);
|
||||||
|
|
|
@ -82,7 +82,7 @@ protected:
|
||||||
|
|
||||||
void processOptions(const options& args);
|
void processOptions(const options& args);
|
||||||
public:
|
public:
|
||||||
void reportVerification(const std::string &/*str*/) OVERRIDE {}
|
void bughuntingReport(const std::string &/*str*/) OVERRIDE {}
|
||||||
void reportOut(const std::string &outmsg) OVERRIDE;
|
void reportOut(const std::string &outmsg) OVERRIDE;
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
void reportErr(const ErrorLogger::ErrorMessage &msg) OVERRIDE;
|
||||||
void run(const std::string &str);
|
void run(const std::string &str);
|
||||||
|
|
Loading…
Reference in New Issue