#6539 Segmentation fault in Tokenizer::duplicateTypedef. Avoid crash on garbage code
This commit is contained in:
parent
130ffc5752
commit
8427398d9d
|
@ -184,7 +184,7 @@ bool Tokenizer::duplicateTypedef(Token **tokPtr, const Token *name, const Token
|
|||
if (end->next()->str() == "(")
|
||||
end = end->linkAt(1);
|
||||
|
||||
end = end->next();
|
||||
end = (end)?end->next():nullptr;
|
||||
}
|
||||
if (end)
|
||||
end = end->next();
|
||||
|
|
|
@ -71,6 +71,7 @@ private:
|
|||
TEST_CASE(garbageCode28);
|
||||
TEST_CASE(garbageCode29);
|
||||
TEST_CASE(garbageCode30); // #5867
|
||||
TEST_CASE(garbageCode31); // #6539
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -393,6 +394,10 @@ private:
|
|||
"}");
|
||||
}
|
||||
|
||||
void garbageCode31() {
|
||||
ASSERT_THROW(checkCode("typedef struct{}x[([],)]typedef e y;(y,x 0){}"), InternalError);
|
||||
}
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||
|
|
Loading…
Reference in New Issue