#6746 segmentation fault (invalid code) in Tokenizer::simplifyTypedef

This commit is contained in:
Alexander Mai 2015-06-02 21:52:08 +02:00
parent 6e1b5a0a53
commit 09f2cff519
2 changed files with 8 additions and 0 deletions

View File

@ -1337,6 +1337,10 @@ void Tokenizer::simplifyTypedef()
tok2 = processFunc(tok2, inOperator);
if (needParen) {
if (!tok2) {
syntaxError(nullptr);
return;
}
tok2->insertToken(")");
tok2 = tok2->next();
Token::createMutualLinks(tok2, tok3);

View File

@ -107,6 +107,7 @@ private:
TEST_CASE(garbageCode66);
TEST_CASE(garbageCode67);
TEST_CASE(garbageCode68);
TEST_CASE(garbageCode69);
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
@ -600,6 +601,9 @@ private:
checkCode("(int a[3]); typedef void (*fp) (void); fp");
}
void garbageCode69() { // #6746
ASSERT_THROW(checkCode("{ (make_mess, aux); } typedef void F(void); aux(void (*x)()) { } (void (*y)()) { } F*"), InternalError);
}
void garbageValueFlow() {
// #6089