#6660: Fixed crash in Tokenize::SetVarid().
This commit is contained in:
parent
88f59ad7e8
commit
785df82513
|
@ -2597,8 +2597,8 @@ void Tokenizer::setVarId()
|
|||
if (!scopeStack.top().isExecutable)
|
||||
newFunctionDeclEnd = isFunctionHead(tok, "{:;");
|
||||
else {
|
||||
Token const * tokenLinkNext = tok->link()->next();
|
||||
if (tokenLinkNext->str() == "{") // might be for- or while-loop or if-statement
|
||||
Token const * const tokenLinkNext = tok->link()->next();
|
||||
if (tokenLinkNext && tokenLinkNext->str() == "{") // might be for- or while-loop or if-statement
|
||||
newFunctionDeclEnd = tokenLinkNext;
|
||||
}
|
||||
if (newFunctionDeclEnd &&
|
||||
|
|
|
@ -402,6 +402,8 @@ private:
|
|||
// a = b = 0;
|
||||
TEST_CASE(multipleAssignment);
|
||||
|
||||
TEST_CASE(setVarId) // #6660 - crash
|
||||
|
||||
TEST_CASE(platformWin);
|
||||
TEST_CASE(platformWin32);
|
||||
TEST_CASE(platformWin32A);
|
||||
|
@ -8711,6 +8713,19 @@ private:
|
|||
ASSERT_EQUALS("sizeof ( a [ 2 ] . b ) + 3 ;", tokenizeAndStringify("sizeof a[2].b+3;"));
|
||||
ASSERT_EQUALS("f ( 0 , sizeof ( ptr . bar ) ) ;", tokenizeAndStringify("f(0, sizeof ptr->bar );"));
|
||||
}
|
||||
|
||||
void setVarId() {
|
||||
const char * code = "CS_PLUGIN_NAMESPACE_BEGIN(csparser)\n"
|
||||
"{\n"
|
||||
" struct foo\n"
|
||||
" {\n"
|
||||
" union\n"
|
||||
" {};\n"
|
||||
" } halo;\n"
|
||||
"}\n"
|
||||
"CS_PLUGIN_NAMESPACE_END(csparser)\n";
|
||||
tokenizeAndStringify(code, true);
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestTokenizer)
|
||||
|
|
Loading…
Reference in New Issue