diff options
author | Timotej Kapus <tk1713@ic.ac.uk> | 2018-05-16 14:25:13 +0100 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2018-05-17 13:50:04 +0100 |
commit | 8fe14b1041f39b61cdb43c32840f3d2cb97cc110 (patch) | |
tree | fc76b0a198bdfaf7512334f2f062ecc544bd9147 /lib/Core | |
parent | 8f2bc3a7188d93edd9a131bfd2101c2ec5adab9e (diff) | |
download | klee-8fe14b1041f39b61cdb43c32840f3d2cb97cc110.tar.gz |
Improve error messages for ReadStringAtAddress
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/SpecialFunctionHandler.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Core/SpecialFunctionHandler.cpp b/lib/Core/SpecialFunctionHandler.cpp index e927adf0..22c27432 100644 --- a/lib/Core/SpecialFunctionHandler.cpp +++ b/lib/Core/SpecialFunctionHandler.cpp @@ -236,9 +236,19 @@ SpecialFunctionHandler::readStringAtAddress(ExecutionState &state, ref<Expr> addressExpr) { ObjectPair op; addressExpr = executor.toUnique(state, addressExpr); + if (!isa<ConstantExpr>(addressExpr)) { + executor.terminateStateOnError( + state, "Symbolic string pointer passed to one of the klee_ functions", + Executor::TerminateReason::User); + return ""; + } ref<ConstantExpr> address = cast<ConstantExpr>(addressExpr); - if (!state.addressSpace.resolveOne(address, op)) - assert(0 && "XXX out of bounds / multiple resolution unhandled"); + if (!state.addressSpace.resolveOne(address, op)) { + executor.terminateStateOnError( + state, "Invalid string pointer passed to one of the klee_ functions", + Executor::TerminateReason::User); + return ""; + } bool res __attribute__ ((unused)); assert(executor.solver->mustBeTrue(state, EqExpr::create(address, |