#6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther
This commit is contained in:
parent
49a9b59490
commit
99524b1f59
|
@ -1435,7 +1435,7 @@ bool CheckOther::checkInnerScope(const Token *tok, const Variable* var, bool& us
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bFirstAssignment=false;
|
bool bFirstAssignment=false;
|
||||||
for (; tok != end; tok = tok->next()) {
|
for (; tok && tok != end; tok = tok->next()) {
|
||||||
if (tok->str() == "goto")
|
if (tok->str() == "goto")
|
||||||
return false;
|
return false;
|
||||||
if (tok->str() == "continue")
|
if (tok->str() == "continue")
|
||||||
|
|
|
@ -122,6 +122,7 @@ private:
|
||||||
TEST_CASE(garbageCode81);
|
TEST_CASE(garbageCode81);
|
||||||
TEST_CASE(garbageCode82);
|
TEST_CASE(garbageCode82);
|
||||||
TEST_CASE(garbageCode83);
|
TEST_CASE(garbageCode83);
|
||||||
|
TEST_CASE(garbageCode84);
|
||||||
|
|
||||||
TEST_CASE(garbageValueFlow);
|
TEST_CASE(garbageValueFlow);
|
||||||
TEST_CASE(garbageSymbolDatabase);
|
TEST_CASE(garbageSymbolDatabase);
|
||||||
|
@ -676,6 +677,10 @@ private:
|
||||||
ASSERT_THROW(checkCode("namespace A { class } class A { friend C ; } { } ;"), InternalError);
|
ASSERT_THROW(checkCode("namespace A { class } class A { friend C ; } { } ;"), InternalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void garbageCode84() { // #6780
|
||||||
|
checkCode("int main ( [ ] ) { " " [ ] ; int i = 0 ; do { } ; } ( [ ] ) { }"); // do not crash
|
||||||
|
}
|
||||||
|
|
||||||
void garbageValueFlow() {
|
void garbageValueFlow() {
|
||||||
// #6089
|
// #6089
|
||||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||||
|
|
Loading…
Reference in New Issue