#6757 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash
This commit is contained in:
parent
5f4902c613
commit
5fd9dd04fa
|
@ -541,6 +541,7 @@ Token *Tokenizer::processFunc(Token *tok2, bool inOperator) const
|
|||
return nullptr;
|
||||
|
||||
if (tok2->str() == "(" &&
|
||||
tok2->link()->next() &&
|
||||
tok2->link()->next()->str() == "(") {
|
||||
tok2 = tok2->link();
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ private:
|
|||
TEST_CASE(garbageCode76);
|
||||
TEST_CASE(garbageCode77);
|
||||
TEST_CASE(garbageCode78);
|
||||
TEST_CASE(garbageCode79);
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -650,6 +651,10 @@ private:
|
|||
checkCode("( ) { [ ] } ( ) { } const_array_of_int ( ) { } typedef int A [ ] [ ] ; A a = { { } { } }");
|
||||
}
|
||||
|
||||
void garbageCode79() { // #6757
|
||||
ASSERT_THROW(checkCode("{ } { } typedef void ( func_type ) ( ) ; func_type & ( )"), InternalError);
|
||||
}
|
||||
|
||||
void garbageValueFlow() {
|
||||
// #6089
|
||||
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"
|
||||
|
|
Loading…
Reference in New Issue