#6732 segmentation fault (invalid code) in Tokenizer::simplifyEmptyNamespaces. Add testcase, segfault seems to have been fixed by previous commit. Run astyle
This commit is contained in:
parent
b81e82d462
commit
fb2bd978ad
|
@ -4503,10 +4503,10 @@ Token *Tokenizer::simplifyAddBracesPair(Token *tok, bool commandWithCondition)
|
|||
tokAfterCondition->previous()->insertToken("{");
|
||||
Token * tokOpenBrace = tokAfterCondition->previous();
|
||||
Token * tokEnd = tokAfterCondition->linkAt(1)->linkAt(2)->linkAt(1);
|
||||
if (!tokEnd) {
|
||||
syntaxError(tokAfterCondition);
|
||||
return nullptr;
|
||||
}
|
||||
if (!tokEnd) {
|
||||
syntaxError(tokAfterCondition);
|
||||
return nullptr;
|
||||
}
|
||||
tokEnd->insertToken("}");
|
||||
Token * tokCloseBrace = tokEnd->next();
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ private:
|
|||
TEST_CASE(garbageCode54); // #6722
|
||||
TEST_CASE(garbageCode55); // #6724
|
||||
TEST_CASE(garbageCode56); // #6713
|
||||
TEST_CASE(garbageCode57); // #6733
|
||||
TEST_CASE(garbageCode57); // #6733
|
||||
TEST_CASE(garbageCode58); // #6732
|
||||
|
||||
TEST_CASE(garbageValueFlow);
|
||||
TEST_CASE(garbageSymbolDatabase);
|
||||
|
@ -545,6 +546,11 @@ private:
|
|||
ASSERT_THROW(checkCode("{ } if () try { } catch (...) B::~B { }"), InternalError);
|
||||
}
|
||||
|
||||
void garbageCode58() { // #6732
|
||||
ASSERT_THROW(checkCode("{ }> {= ~A()^{} }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