#7043 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl
This commit is contained in:
parent
6dcb918b78
commit
600641c4c5
|
@ -5299,6 +5299,8 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_
|
|||
tok = tok->link();
|
||||
}
|
||||
|
||||
if (!tok)
|
||||
syntaxError(nullptr); // #7043 invalid code
|
||||
if (tok->previous() && !Token::Match(tok->previous(), "{|}|;|)|public:|protected:|private:"))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ private:
|
|||
TEST_CASE(garbageCode138); // #6660
|
||||
TEST_CASE(garbageCode139); // #6659
|
||||
TEST_CASE(garbageCode140); // #7035
|
||||
TEST_CASE(garbageCode141); // #7043
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -1109,6 +1110,10 @@ private:
|
|||
ASSERT_THROW(checkCode("int foo(int align) { int off(= 0 % align; return off) ? \\ align - off : 0; \\ }"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode141() { // #7043
|
||||
ASSERT_THROW(checkCode("enum { X = << { X } } enum { X = X } = X ;"), InternalError);
|
||||
}
|
||||
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
|
|
Loading…
Reference in New Issue