diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 00e48ab0c9c..a18b5361bec 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8731,10 +8731,13 @@ void Tokenizer::findGarbageCode() const } if (Token::Match(tok, "%num%|%bool%|%char%|%str% %num%|%bool%|%char%|%str%") && !Token::Match(tok, "%str% %str%")) syntaxError(tok); - if (Token::Match(tok, "%num%|%bool%|%char%|%str% {") && - !(tok->tokType() == Token::Type::eString && Token::simpleMatch(tok->tokAt(-1), "extern")) && - !(tok->tokType() == Token::Type::eBoolean && cpp && Token::simpleMatch(tok->tokAt(-1), "requires"))) - syntaxError(tok); + if (Token::Match(tok, "%num%|%bool%|%char%|%str% {|(")) { + if (tok->strAt(1) == "(") + syntaxError(tok); + else if (!(tok->tokType() == Token::Type::eString && Token::simpleMatch(tok->tokAt(-1), "extern")) && + !(tok->tokType() == Token::Type::eBoolean && cpp && Token::simpleMatch(tok->tokAt(-1), "requires"))) + syntaxError(tok); + } if (Token::Match(tok, "%assign% typename|class %assign%")) syntaxError(tok); if (Token::Match(tok, "%assign% [;)}]") && (!cpp || !Token::simpleMatch(tok->previous(), "operator"))) diff --git a/test/cli/fuzz-crash/crash-1bcbece2593792b0d34fb8f5dbacbae22decd082 b/test/cli/fuzz-crash/crash-1bcbece2593792b0d34fb8f5dbacbae22decd082 new file mode 100644 index 00000000000..c95fb490043 --- /dev/null +++ b/test/cli/fuzz-crash/crash-1bcbece2593792b0d34fb8f5dbacbae22decd082 @@ -0,0 +1 @@ +enum{A=0()7=F}; \ No newline at end of file