Fix hang in libdmtx package. found through daca2.
This commit is contained in:
parent
970fda9e79
commit
bdfe43d82c
|
@ -1267,7 +1267,8 @@ static void valueFlowForLoopSimplify(Token * const bodyStart, const unsigned int
|
||||||
const Token *parent = tok2;
|
const Token *parent = tok2;
|
||||||
while (parent && parent->str() == tok2->str())
|
while (parent && parent->str() == tok2->str())
|
||||||
parent = parent->astParent();
|
parent = parent->astParent();
|
||||||
if (parent && parent->str() == "(")
|
// Jump to end of condition
|
||||||
|
if (parent && parent->str() == "(" && parent->astOperand2())
|
||||||
tok2 = parent->link();
|
tok2 = parent->link();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1070,6 +1070,13 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
|
ASSERT_EQUALS(false, testValueOfX(code, 4U, 0));
|
||||||
ASSERT_EQUALS(true, testValueOfX(code, 4U, 9));
|
ASSERT_EQUALS(true, testValueOfX(code, 4U, 9));
|
||||||
|
|
||||||
|
// hang
|
||||||
|
code = "void f() {\n"
|
||||||
|
" for(int i = 0; i < 20; i++)\n"
|
||||||
|
" n = (int)(i < 10 || abs(negWander) < abs(negTravel));\n"
|
||||||
|
"}";
|
||||||
|
testValueOfX(code,0,0); // <- dont hang
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowSubFunction() {
|
void valueFlowSubFunction() {
|
||||||
|
|
Loading…
Reference in New Issue