#7235 segmentation fault (invalid code) in TokenList::createAst
This commit is contained in:
parent
36a6599386
commit
081f443b2a
|
@ -981,6 +981,8 @@ static Token * createAstAtToken(Token *tok, bool cpp)
|
|||
compileExpression(tok2, state2);
|
||||
|
||||
Token * const semicolon2 = tok2;
|
||||
if (!semicolon2)
|
||||
return nullptr; // invalid code #7235
|
||||
tok2 = tok2->next();
|
||||
AST_state state3(cpp);
|
||||
compileExpression(tok2, state3);
|
||||
|
|
|
@ -213,6 +213,7 @@ private:
|
|||
TEST_CASE(garbageCode162); // #7208
|
||||
TEST_CASE(garbageCode163); // #7228
|
||||
TEST_CASE(garbageCode164); // #7234
|
||||
TEST_CASE(garbageCode165); // #7235
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
TEST_CASE(garbageAST);
|
||||
|
@ -1405,6 +1406,10 @@ private:
|
|||
ASSERT_THROW(checkCode("class d{k p;}(){d::d():B<()}", false), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode165() {
|
||||
//7235
|
||||
checkCode("for(;..)", false);
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestGarbage)
|
||||
|
|
Loading…
Reference in New Issue