Skip to content

Commit

Permalink
fix cdg null deref
Browse files Browse the repository at this point in the history
  • Loading branch information
jumormt committed Sep 19, 2024
1 parent ded62ab commit 658520e
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions svf/lib/Util/CDGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,7 @@ s64_t CDGBuilder::getBBSuccessorBranchID(const SVFBasicBlock *BB, const SVFBasic
// to label %invoke.cont1 unwind label %lpad
pred = callNode->getRetICFGNode();
}
const ICFGEdge *edge = nullptr;
for (const auto &node: Succ->getICFGNodeList())
{
if (const ICFGEdge *e = icfg->getICFGEdge(pred, node, ICFGEdge::ICFGEdgeK::IntraCF))
{
edge = e;
break;
}
}
const ICFGEdge *edge = icfg->getICFGEdge(pred, Succ->front(), ICFGEdge::ICFGEdgeK::IntraCF);

Check warning on line 98 in svf/lib/Util/CDGBuilder.cpp

View check run for this annotation

Codecov / codecov/patch

svf/lib/Util/CDGBuilder.cpp#L98

Added line #L98 was not covered by tests
if (const IntraCFGEdge *intraEdge = SVFUtil::dyn_cast<IntraCFGEdge>(edge))
{
if(intraEdge->getCondition())
Expand Down Expand Up @@ -230,9 +222,10 @@ void CDGBuilder::buildICFGNodeControlMap()
// not a branch statement:
// invoke void %3(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %2)
// to label %invoke.cont1 unwind label %lpad
_controlDG->addCDGEdgeFromSrcDst(controlNode, controllee,
nullptr,
pos);
SVFIR* pag = PAG::getPAG();
_controlDG->addCDGEdgeFromSrcDst(

Check warning on line 226 in svf/lib/Util/CDGBuilder.cpp

View check run for this annotation

Codecov / codecov/patch

svf/lib/Util/CDGBuilder.cpp#L225-L226

Added lines #L225 - L226 were not covered by tests
controlNode, controllee,
pag->getGNode(pag->getNullPtr()), pos);

Check warning on line 228 in svf/lib/Util/CDGBuilder.cpp

View check run for this annotation

Codecov / codecov/patch

svf/lib/Util/CDGBuilder.cpp#L228

Added line #L228 was not covered by tests
}

}
Expand Down

0 comments on commit 658520e

Please sign in to comment.