@@ -1300,8 +1300,15 @@ void SpecialFunctionHandler::handleAddTaint(klee::ExecutionState &state,
13001300
13011301 uint64_t taintSource = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
13021302// printf("klee_add_taint source: %zu\n", taintSource);
1303- executor.executeChangeTaintSource (
1304- state, target, executor.makePointer (arguments[0 ]), taintSource, true );
1303+
1304+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1305+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1306+ if (p->isKnownValue ()) {
1307+ pointer =
1308+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1309+ }
1310+ }
1311+ executor.executeChangeTaintSource (state, target, pointer, taintSource, true );
13051312}
13061313
13071314void SpecialFunctionHandler::handleClearTaint (
@@ -1316,8 +1323,15 @@ void SpecialFunctionHandler::handleClearTaint(
13161323
13171324 uint64_t taintSource = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
13181325// printf("klee_clear_taint source: %zu\n", taintSource);
1319- executor.executeChangeTaintSource (
1320- state, target, executor.makePointer (arguments[0 ]), taintSource, false );
1326+
1327+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1328+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1329+ if (p->isKnownValue ()) {
1330+ pointer =
1331+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1332+ }
1333+ }
1334+ executor.executeChangeTaintSource (state, target, pointer, taintSource, false );
13211335}
13221336
13231337void SpecialFunctionHandler::handleCheckTaintSource (
@@ -1332,8 +1346,15 @@ void SpecialFunctionHandler::handleCheckTaintSource(
13321346
13331347 uint64_t taintSource = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
13341348// printf("klee_check_taint_source source: %zu\n", taintSource);
1335- executor.executeCheckTaintSource (
1336- state, target, executor.makePointer (arguments[0 ]), taintSource);
1349+
1350+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1351+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1352+ if (p->isKnownValue ()) {
1353+ pointer =
1354+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1355+ }
1356+ }
1357+ executor.executeCheckTaintSource (state, target, pointer, taintSource);
13371358}
13381359
13391360void SpecialFunctionHandler::handleGetTaintHits (
@@ -1348,8 +1369,15 @@ void SpecialFunctionHandler::handleGetTaintHits(
13481369
13491370 uint64_t taintSink = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
13501371// printf("klee_get_taint_hits sink: %zu\n", taintSink);
1351- executor.executeGetTaintHits (state, target,
1352- executor.makePointer (arguments[0 ]), taintSink);
1372+
1373+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1374+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1375+ if (p->isKnownValue ()) {
1376+ pointer =
1377+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1378+ }
1379+ }
1380+ executor.executeGetTaintHits (state, target, pointer, taintSink);
13531381}
13541382
13551383void SpecialFunctionHandler::handleTaintHit (klee::ExecutionState &state,
0 commit comments