Fixed #4175 (segmentation fault of cppcheck)
This commit is contained in:
parent
cf8ac78069
commit
d3bdd84d8b
|
@ -1072,7 +1072,7 @@ void CheckUninitVar::checkScope(const Scope* scope)
|
||||||
|
|
||||||
bool stdtype = _tokenizer->isC();
|
bool stdtype = _tokenizer->isC();
|
||||||
const Token* tok = i->typeStartToken();
|
const Token* tok = i->typeStartToken();
|
||||||
for (; tok->str() != ";" && tok->str() != "<"; tok = tok->next()) {
|
for (; tok && tok->str() != ";" && tok->str() != "<"; tok = tok->next()) {
|
||||||
if (tok->isStandardType())
|
if (tok->isStandardType())
|
||||||
stdtype = true;
|
stdtype = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2126,6 +2126,8 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
checkUninitVar2(">{ x while (y) z int = }"); // #4175 : don't crash
|
||||||
|
|
||||||
// try
|
// try
|
||||||
checkUninitVar2("void f() {\n"
|
checkUninitVar2("void f() {\n"
|
||||||
" int i, *p = &i;\n"
|
" int i, *p = &i;\n"
|
||||||
|
|
Loading…
Reference in New Issue