Fix issue 10027: Segmentation fault in ValueFlowAnalyzer::analyze (#2987)
This commit is contained in:
parent
9d54303cfa
commit
bd22070df5
|
@ -128,6 +128,9 @@ struct ReverseTraversal {
|
||||||
break;
|
break;
|
||||||
// Evaluate LHS of assignment before RHS
|
// Evaluate LHS of assignment before RHS
|
||||||
if (Token* assignTok = assignExpr(tok)) {
|
if (Token* assignTok = assignExpr(tok)) {
|
||||||
|
// If assignTok has broken ast then stop
|
||||||
|
if (!assignTok->astOperand1() || !assignTok->astOperand2())
|
||||||
|
break;
|
||||||
Token* assignTop = assignTok;
|
Token* assignTop = assignTok;
|
||||||
bool continueB = true;
|
bool continueB = true;
|
||||||
while (assignTop->isAssignmentOp()) {
|
while (assignTop->isAssignmentOp()) {
|
||||||
|
|
|
@ -4978,6 +4978,20 @@ private:
|
||||||
" }\n"
|
" }\n"
|
||||||
"};\n";
|
"};\n";
|
||||||
valueOfTok(code, "c");
|
valueOfTok(code, "c");
|
||||||
|
|
||||||
|
code = "void f() {\n"
|
||||||
|
" char* p = 0;\n"
|
||||||
|
" int pi =\n"
|
||||||
|
" p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 \n"
|
||||||
|
" : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 \n"
|
||||||
|
" : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 \n"
|
||||||
|
" : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 \n"
|
||||||
|
" : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 : p == \"a\" ? 1 \n"
|
||||||
|
" : 0;\n"
|
||||||
|
" int *i2 = 0;\n"
|
||||||
|
" if (i2) { }\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, "p");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowHang() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue