Fix 10957: Crash on valid code (#3991)

This commit is contained in:
Paul Fultz II 2022-04-10 15:47:58 -05:00 committed by GitHub
parent bd9f5231b8
commit 45b4580554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -5736,6 +5736,9 @@ struct ConditionHandler {
std::swap(thenValues, elseValues);
}
if (!condTop)
return;
if (Token::simpleMatch(condTop, "?")) {
Token* colon = condTop->astOperand2();
forward(colon->astOperand1(), cond.vartok, thenValues, tokenlist, settings);

View File

@ -6442,6 +6442,9 @@ private:
" void f(std::array<T*, 2>& a);\n"
"};\n";
valueOfTok(code, "a");
code = "void f(const char * const x) { !!system(x); }\n";
valueOfTok(code, "x");
}
void valueFlowHang() {