Skip to content
Merged
Changes from all commits
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
22 changes: 14 additions & 8 deletions lib/Core/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ cl::opt<bool>
cl::desc("Enable lazy initialization (default=true)"),
cl::cat(ExecCat));

cl::opt<bool> ForkPartialValidity("fork-partial-validity", cl::init(false),
cl::cat(ExecCat));
cl::opt<bool>
ForkPartialValidity("fork-partial-validity", cl::init(false),
cl::desc("Use partial validity to accurately handle "
"solver results (default=false)"),
cl::cat(ExecCat));

cl::opt<TypeSystemKind>
TypeSystem("type-system",
Expand Down Expand Up @@ -1171,7 +1174,7 @@ Executor::StatePair Executor::fork(ExecutionState &current, ref<Expr> condition,
}

if (res == Solver::PartialValidity::MayBeTrue) {
current.addConstraint(condition);
addConstraint(current, condition);
}
return StatePair(&current, nullptr);
} else if (res == Solver::PartialValidity::MustBeFalse ||
Expand All @@ -1183,7 +1186,7 @@ Executor::StatePair Executor::fork(ExecutionState &current, ref<Expr> condition,
}

if (res == Solver::PartialValidity::MayBeFalse) {
current.addConstraint(Expr::createIsZero(condition));
addConstraint(current, Expr::createIsZero(condition));
}
return StatePair(nullptr, &current);
} else {
Expand Down Expand Up @@ -5193,10 +5196,10 @@ void Executor::executeMemoryOperation(
ref<Expr> inBounds = mo->getBoundsCheckPointer(address, bytes);
ref<Expr> outOfBound = NotExpr::create(inBounds);
if (state.isGEPExpr(address)) {
inBounds =
AndExpr::create(inBounds, mo->getBoundsCheckPointer(base, 1));
inBounds =
AndExpr::create(inBounds, mo->getBoundsCheckPointer(base, size));
inBounds = AndExpr::create(inBounds,
Expr::createIsZero(mo->getOffsetExpr(base)));
outOfBound =
AndExpr::create(outOfBound, mo->getBoundsCheckPointer(base));
}
Expand Down Expand Up @@ -5227,6 +5230,9 @@ void Executor::executeMemoryOperation(

for (unsigned int i = 0; i < resolvedMemoryObjects.size(); ++i) {
ExecutionState *bound = statesForMemoryOperation[i];
if (!bound) {
continue;
}
ObjectPair op = bound->addressSpace.findObject(resolvedMemoryObjects[i]);
const MemoryObject *mo = op.first;
const ObjectState *os = op.second;
Expand Down Expand Up @@ -5293,10 +5299,10 @@ void Executor::executeMemoryOperation(

ref<Expr> inBounds = mo->getBoundsCheckPointer(address, bytes);
if (unbound->isGEPExpr(address)) {
inBounds =
AndExpr::create(inBounds, mo->getBoundsCheckPointer(base, 1));
inBounds =
AndExpr::create(inBounds, mo->getBoundsCheckPointer(base, size));
inBounds = AndExpr::create(inBounds,
Expr::createIsZero(mo->getOffsetExpr(base)));
}

StatePair sp = fork(*unbound, inBounds, true, BranchType::MemOp);
Expand Down