Hi, I'm modifying KLEE to enable better string support with dedicated solvers. Inside SpecialFunctionHandler.cpp, I have written various handlers for "hijacking" string functions. In the following code sample I (artificially) ask if some string can satisfy 3 demands:
[1] AB_q_name == "TT8G" [2] strchr(AB_q_name, "8") == 2 [3] strchr(AB_q_name, "T") == 3
And I expect the answer to be no. However, when using this code, KLEE hits the assert. If I remove the comments and add the constraint everything works fine. What am I doing wrong? Thanks in advance!!
ref<Expr> myVar = StrVarExpr::create(AB_q_name);
ref<Expr> AB_q_name_eq_TT8G =
StrEqExpr::create(
myVar,
StrConstExpr::create("TT8G"));
state.addConstraint(AB_q_name_eq_TT8G);
ref<Expr> RUNNING_EXAMPLE =
//AndExpr::create(AB_q_name_eq_TT8G,
AndExpr::create(
EqExpr::create(
StrFirstIdxOfExpr::create(
myVar,
StrConstExpr::create("8")),
ConstantExpr::create(2,Expr::Int32)),
EqExpr::create(
StrFirstIdxOfExpr::create(
myVar,
StrConstExpr::create("T")),
ConstantExpr::create(3,Expr::Int32)))/*)*/;
success = executor.solver->mayBeTrue(state,RUNNING_EXAMPLE,result);
if (result)
{
klee_error("THIS SHOULD NOT BE PRINTED !!!");
assert(0);
}
该提问来源于开源项目:klee/klee