#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();
|
||||
if (!t)
|
||||
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.
|
||||
return false;
|
||||
tokens.push(t->astOperand1());
|
||||
|
|
|
@ -1267,6 +1267,10 @@ private:
|
|||
// #6106
|
||||
code = " f { int i ; b2 , [ ] ( for ( i = 0 ; ; ) ) }";
|
||||
valueOfTok(code, "*");
|
||||
|
||||
// 6122 survive garbage code
|
||||
code = "; { int i ; for ( i = 0 ; = 123 ; ) - ; }";
|
||||
valueOfTok(code, "*");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue