Fixed #4941 (segmentation fault (invalid code) in Tokenizer::setVarId)
This commit is contained in:
parent
2eca0a93a7
commit
3bd1d53c75
|
@ -1806,7 +1806,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
const Token *last = tok->next()->link();
|
||||
if (start != tok) {
|
||||
last = last->next();
|
||||
while (last && !Token::Match(last, "[;{}]"))
|
||||
while (last && !Token::Match(last->next(), "[;{}()]"))
|
||||
last = last->next();
|
||||
}
|
||||
if (start && last) {
|
||||
|
|
|
@ -746,7 +746,8 @@ private:
|
|||
// #4725 - ^{}
|
||||
void tokenize28() {
|
||||
ASSERT_EQUALS("void f ( ) { asm ( \"^{}\" ) ; }", tokenizeAndStringify("void f() { ^{} }"));
|
||||
ASSERT_EQUALS("void f ( ) { asm ( \"x(^{});\" ) ; }", tokenizeAndStringify("void f() { x(^{}); }"));
|
||||
ASSERT_EQUALS("void f ( ) { asm ( \"x(^{})\" ) ; }", tokenizeAndStringify("void f() { x(^{}); }"));
|
||||
ASSERT_EQUALS("; asm ( \"voidf^{return}intmain\" ) ; ( ) { }", tokenizeAndStringify("; void f ^ { return } int main ( ) { }"));
|
||||
}
|
||||
|
||||
void wrong_syntax1() {
|
||||
|
|
Loading…
Reference in New Issue