Fix #11627 Infinite loop in ReverseTraversal (#4916)

This commit is contained in:
chrchr-github 2023-03-30 07:22:41 +02:00 committed by GitHub
parent 13e12da08f
commit fc24f760cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -78,10 +78,10 @@ struct ReverseTraversal {
return nullptr;
if (ftok->index() >= tok->index())
return nullptr;
if (ftok->link())
ftok = ftok->link()->next();
else
if (!ftok->link() || ftok->str() == ")")
ftok = ftok->next();
else
ftok = ftok->link()->next();
}
if (ftok == tok)
return nullptr;

View File

@ -6980,6 +6980,11 @@ private:
" void g(std::vector<int> (*f) () = nullptr);\n"
"};\n";
valueOfTok(code, "=");
code = "void f(bool b) {\n" // #11627
" (*printf)(\"%s %i\", strerror(errno), b ? 0 : 1);\n"
"};\n";
valueOfTok(code, "?");
}
void valueFlowHang() {