Fixed #5195 (Crash below CheckIO::checkWrongPrintfScanfArguments())
This commit is contained in:
parent
8cca41774d
commit
0afdbc73da
|
@ -1407,7 +1407,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings)
|
||||||
varTok = tok1->previous();
|
varTok = tok1->previous();
|
||||||
variableInfo = varTok->variable();
|
variableInfo = varTok->variable();
|
||||||
|
|
||||||
if (!isStdVectorOrString()) {
|
if (!variableInfo || !isStdVectorOrString()) {
|
||||||
variableInfo = 0;
|
variableInfo = 0;
|
||||||
typeToken = 0;
|
typeToken = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2098,6 +2098,12 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'char'.\n"
|
ASSERT_EQUALS("[test.cpp:3]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'char'.\n"
|
||||||
"[test.cpp:3]: (warning) %f in format string (no. 3) requires 'double' but the argument type is 'char'.\n", errout.str());
|
"[test.cpp:3]: (warning) %f in format string (no. 3) requires 'double' but the argument type is 'char'.\n", errout.str());
|
||||||
|
|
||||||
|
// #5195 (segmentation fault)
|
||||||
|
check("void T::a(const std::vector<double>& vx) {\n"
|
||||||
|
" printf(\"%f\", vx.at(0));\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void testPosixPrintfScanfParameterPosition() { // #4900 - No support for parameters in format strings
|
void testPosixPrintfScanfParameterPosition() { // #4900 - No support for parameters in format strings
|
||||||
|
|
Loading…
Reference in New Issue