#6122 segmentation fault (invalid code) in in valueFlowForLoop2. Simple fix and testcase.
This commit is contained in:
parent
45dc4ca6be
commit
a632f68345
|
@ -1266,7 +1266,7 @@ static bool valueFlowForLoop2(const Token *tok,
|
||||||
tokens.pop();
|
tokens.pop();
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
if (t->str() == "=" && programMemory.find(t->astOperand1()->varId()) != programMemory.end())
|
if (t->str() == "=" && t->astOperand1() && programMemory.find(t->astOperand1()->varId()) != programMemory.end())
|
||||||
// TODO: investigate what variable is assigned.
|
// TODO: investigate what variable is assigned.
|
||||||
return false;
|
return false;
|
||||||
tokens.push(t->astOperand1());
|
tokens.push(t->astOperand1());
|
||||||
|
|
|
@ -1267,6 +1267,10 @@ private:
|
||||||
// #6106
|
// #6106
|
||||||
code = " f { int i ; b2 , [ ] ( for ( i = 0 ; ; ) ) }";
|
code = " f { int i ; b2 , [ ] ( for ( i = 0 ; ; ) ) }";
|
||||||
valueOfTok(code, "*");
|
valueOfTok(code, "*");
|
||||||
|
|
||||||
|
// 6122 survive garbage code
|
||||||
|
code = "; { int i ; for ( i = 0 ; = 123 ; ) - ; }";
|
||||||
|
valueOfTok(code, "*");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue