Skip to content

Commit

Permalink
fix some external calls with symbolic values
Browse files Browse the repository at this point in the history
if the value can be solved, use it for the external call

fixup! fix some external calls with symbolic values
  • Loading branch information
capsosk committed Oct 22, 2022
1 parent 52152e5 commit 07345b2
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/Core/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3962,16 +3962,21 @@ void Executor::callExternalFunction(ExecutionState &state,
} else {
arg = toUnique(state, ai->getValue());
}
if (ConstantExpr *ce = dyn_cast<ConstantExpr>(arg)) {
// XXX kick toMemory functions from here
ce->toMemory(&args[wordIndex]);
wordIndex += (ce->getWidth() + 63) / 64;
} else {
terminateStateOnExecError(state,
"external call with symbolic argument: " +
function->getName());
return;

ref<ConstantExpr> ce = dyn_cast<ConstantExpr>(arg);
if (nullptr == ce.get()) {

bool result = solver->getValue(state, arg, ce);
if (!result) {
terminateStateOnExecError(state,
"external call with symbolic argument: " +
function->getName());
return;
}
}
// XXX kick toMemory functions from here
ce->toMemory(&args[wordIndex]);
wordIndex += (ce->getWidth() + 63) / 64;
}
}

Expand Down

0 comments on commit 07345b2

Please sign in to comment.