Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState() (#3815)

* Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState()

* Format
This commit is contained in:
Paul Fultz II 2022-02-10 00:43:27 -06:00 committed by GitHub
parent 09da69b1c7
commit a50452517d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -6306,6 +6306,8 @@ struct MultiValueFlowAnalyzer : ValueFlowAnalyzer {
ProgramState ps; ProgramState ps;
for (const auto& p : values) { for (const auto& p : values) {
const Variable* var = vars.at(p.first); const Variable* var = vars.at(p.first);
if (!var)
continue;
ps[var->nameToken()] = p.second; ps[var->nameToken()] = p.second;
} }
return ps; return ps;

View File

@ -6273,6 +6273,16 @@ private:
" }\n" " }\n"
"};\n"; "};\n";
valueOfTok(code, "f.c"); valueOfTok(code, "f.c");
code = "void d(fmpz_t a, fmpz_t b) {\n"
" if (fmpz_sgn(0)) {}\n"
" else if (b) {}\n"
"}\n"
"void e(psl2z_t f) {\n"
" f->b;\n"
" d(&f->a, c);\n"
"}\n";
valueOfTok(code, "f");
} }
void valueFlowHang() { void valueFlowHang() {