#6722 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
This commit is contained in:
parent
d5d6d7fbb8
commit
4050d56169
|
@ -903,6 +903,10 @@ void Tokenizer::simplifyTypedef()
|
|||
typeName = tokOffset->previous();
|
||||
argStart = tokOffset->next();
|
||||
argEnd = tokOffset->next()->link();
|
||||
if (!argEnd) {
|
||||
syntaxError(argStart);
|
||||
return;
|
||||
}
|
||||
tok = argEnd->next();
|
||||
Token *spec = tok;
|
||||
if (Token::Match(spec, "const|volatile")) {
|
||||
|
|
|
@ -92,6 +92,7 @@ private:
|
|||
TEST_CASE(garbageCode51); // #6719
|
||||
TEST_CASE(garbageCode52); // #6720
|
||||
TEST_CASE(garbageCode53); // #6721
|
||||
TEST_CASE(garbageCode54); // #6722
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -525,6 +526,10 @@ private:
|
|||
checkCode("{ { } }; void foo (struct int i) { x->b[i] = = }");
|
||||
}
|
||||
|
||||
void garbageCode54() { // #6722
|
||||
ASSERT_THROW(checkCode("{ typedef long ((pf) p) (); }"), InternalError);
|
||||
}
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||
|
|
Loading…
Reference in New Issue