Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]add AbstractValue #1423

Merged
merged 7 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix some bugs for big prog
  • Loading branch information
bjjwwang committed Apr 3, 2024
commit 79249a0cebf8fe4a6d3bad18f65d8f220a156b55
3 changes: 2 additions & 1 deletion svf/lib/AE/Svfexe/AbstractExecution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,6 @@ void AbstractExecution::handleMemcpy(const SVF::SVFValue *dst, const SVF::SVFVal

const SVFType* AbstractExecution::getPointeeElement(NodeID id)
{
assert(_svfir2ExeState->inVarToAddrsTable(id) && "id is not in varToAddrsTable");
if (_svfir2ExeState->inVarToAddrsTable(id))
{
const AbstractValue& addrs = _svfir2ExeState->getAddrs(id);
Expand All @@ -1650,6 +1649,8 @@ const SVFType* AbstractExecution::getPointeeElement(NodeID id)
continue;
return SVFUtil::dyn_cast<ObjVar>(_svfir->getGNode(addr_id))->getMemObj()->getType();
}
} else {
// do nothing if no record in addrs table.
}
return nullptr;
}
Expand Down
5 changes: 4 additions & 1 deletion svf/lib/AE/Svfexe/BufOverflowChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ void BufOverflowChecker::initExtFunMap()
}
else if (strValue->getType()->isPointerTy())
{
elemSize = getPointeeElement(_svfir->getValueNode(strValue))->getByteSize();
if (const SVFType* pointee = getPointeeElement(_svfir->getValueNode(strValue)))
elemSize = pointee->getByteSize();
else
elemSize = 1;
}
u32_t lhsId = _svfir->getValueNode(cs.getInstruction());
es[lhsId] = dst_size / IntervalValue(elemSize);
Expand Down
15 changes: 12 additions & 3 deletions svf/lib/AE/Svfexe/SVFIR2ItvExeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ AbstractValue SVFIR2ItvExeState::getRangeLimitFromType(const SVFType* type)
}
else
{
assert(false && "cannot support");
abort();
return IntervalValue::top();
// other types, return top interval
}
}

Expand Down Expand Up @@ -1003,8 +1003,17 @@ void SVFIR2ItvExeState::translateCopy(const CopyStmt *copy)
{
_es[lhs] = IntervalValue::top();
}
else
else if (copy->getCopyKind() == CopyStmt::BITCAST)
{
if (_es[rhs].isAddr()) {
_es[lhs] = _es[rhs];
}
else
{
// do nothing
}
}
else {
assert(false && "undefined copy kind");
abort();
}
Expand Down