Fix #12255 Crash in executeMultiCondition() (#5752)

This commit is contained in:
chrchr-github 2023-12-11 17:15:21 +01:00 committed by GitHub
parent faafd93b89
commit 30e8814ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -1341,6 +1341,8 @@ namespace {
for (const auto& p : *pm) {
const Token* tok = p.first.tok;
if (!tok)
continue;
const ValueFlow::Value& value = p.second;
if (tok->str() == expr->str() && !astHasExpr(tok, expr->exprId())) {

View File

@ -7275,6 +7275,17 @@ private:
" if (a && b) {}\n"
"}\n";
valueOfTok(code, "a");
code = "void g(const char* fmt, ...);\n" // #12255
"void f(const char* fmt, const char* msg) {\n"
" const char* p = msg;\n"
" g(\"%s\", msg);\n"
"}\n"
"void g(const char* fmt, ...) {\n"
" const char* q = fmt;\n"
" if (*q > 0 && *q < 100) {}\n"
"}\n";
valueOfTok(code, "&&");
}
void valueFlowHang() {