Fixed crash on garbage code (#7085)
This commit is contained in:
parent
6c20f4b2a2
commit
83a816b109
|
@ -4304,6 +4304,8 @@ void Tokenizer::removeRedundantFor()
|
|||
const Token *vartok2 = tok->linkAt(2)->previous();
|
||||
if (vartok2->str() == "++")
|
||||
vartok2 = vartok2->previous();
|
||||
else if (vartok2->strAt(-1) != "++")
|
||||
continue;
|
||||
if (varname != vartok2->str())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -197,6 +197,7 @@ private:
|
|||
TEST_CASE(garbageCode146); // #7081
|
||||
TEST_CASE(garbageCode147); // #7082
|
||||
TEST_CASE(garbageCode148); // #7090
|
||||
TEST_CASE(garbageCode149); // #7085
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -1177,6 +1178,13 @@ private:
|
|||
"b[0][0]"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode149() { // #7085
|
||||
checkCode("int main() {\n"
|
||||
" for (j = 0; j < 1; j)\n"
|
||||
" j6;\n"
|
||||
"}");
|
||||
}
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||
|
|
Loading…
Reference in New Issue