Fix 10665: Crash in ExpressionAnalyzer (#3661)
This commit is contained in:
parent
4b04c86249
commit
50862d1ace
|
@ -5100,6 +5100,10 @@ static void valueFlowAfterSwap(TokenList* tokenlist,
|
||||||
std::vector<Token*> args = astFlatten(tok->next()->astOperand2(), ",");
|
std::vector<Token*> args = astFlatten(tok->next()->astOperand2(), ",");
|
||||||
if (args.size() != 2)
|
if (args.size() != 2)
|
||||||
continue;
|
continue;
|
||||||
|
if (args[0]->exprId() == 0)
|
||||||
|
continue;
|
||||||
|
if (args[1]->exprId() == 0)
|
||||||
|
continue;
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
std::vector<const Variable*> vars = getVariables(args[0]);
|
std::vector<const Variable*> vars = getVariables(args[0]);
|
||||||
std::list<ValueFlow::Value> values = args[0]->values();
|
std::list<ValueFlow::Value> values = args[0]->values();
|
||||||
|
|
|
@ -6330,6 +6330,14 @@ private:
|
||||||
" && ch != '\\\'' && ch != '\\\"');\n"
|
" && ch != '\\\'' && ch != '\\\"');\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "return");
|
valueOfTok(code, "return");
|
||||||
|
|
||||||
|
code = "void heapSort() {\n"
|
||||||
|
" int n = m_size;\n"
|
||||||
|
" while (n >= 1) {\n"
|
||||||
|
" swap(0, n - 1);\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, "swap");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowCrashConstructorInitialization() { // #9577
|
void valueFlowCrashConstructorInitialization() { // #9577
|
||||||
|
|
Loading…
Reference in New Issue