Fixed #3034 (Cppcheck crash on specific file (truecrypt).)

This commit is contained in:
Daniel Marjamäki 2011-08-29 19:16:52 +02:00
parent 7775934492
commit ef30da51bf
2 changed files with 15 additions and 0 deletions

View File

@ -720,6 +720,8 @@ void CheckBufferOverrun::checkFunctionParameter(const Token &tok, unsigned int p
ftok = ftok->next()->link()->next()->link();
if (Token::simpleMatch(ftok, "} else {"))
ftok = ftok->tokAt(2)->link();
if (!ftok)
break;
continue;
}
}

View File

@ -209,6 +209,7 @@ private:
TEST_CASE(crash1); // Ticket #1587 - crash
TEST_CASE(crash2); // Ticket #2607 - crash
TEST_CASE(crash3); // Ticket #3034 - crash
TEST_CASE(executionPaths1);
TEST_CASE(executionPaths2);
@ -2900,6 +2901,18 @@ private:
check("struct C {} {} x");
}
void crash3()
{
check("void a(char *p) {\n"
" f( { if(finally_arg); } );\n"
"}\n"
"\n"
"void b() {\n"
" char arr[64];\n"
" a(arr);\n"
"}");
}
void epcheck(const char code[])
{