@@ -1299,9 +1299,15 @@ void SpecialFunctionHandler::handleAddTaint(klee::ExecutionState &state,
1299
1299
}
1300
1300
1301
1301
uint64_t taintSource = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
1302
- // printf("klee_add_taint source: %zu\n", taintSource);
1303
- executor.executeChangeTaintSource (
1304
- state, target, executor.makePointer (arguments[0 ]), taintSource, true );
1302
+
1303
+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1304
+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1305
+ if (p->isKnownValue ()) {
1306
+ pointer =
1307
+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1308
+ }
1309
+ }
1310
+ executor.executeChangeTaintSource (state, target, pointer, taintSource, true );
1305
1311
}
1306
1312
1307
1313
void SpecialFunctionHandler::handleClearTaint (
@@ -1315,9 +1321,15 @@ void SpecialFunctionHandler::handleClearTaint(
1315
1321
}
1316
1322
1317
1323
uint64_t taintSource = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
1318
- // printf("klee_clear_taint source: %zu\n", taintSource);
1319
- executor.executeChangeTaintSource (
1320
- state, target, executor.makePointer (arguments[0 ]), taintSource, false );
1324
+
1325
+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1326
+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1327
+ if (p->isKnownValue ()) {
1328
+ pointer =
1329
+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1330
+ }
1331
+ }
1332
+ executor.executeChangeTaintSource (state, target, pointer, taintSource, false );
1321
1333
}
1322
1334
1323
1335
void SpecialFunctionHandler::handleCheckTaintSource (
@@ -1331,9 +1343,15 @@ void SpecialFunctionHandler::handleCheckTaintSource(
1331
1343
}
1332
1344
1333
1345
uint64_t taintSource = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
1334
- // printf("klee_check_taint_source source: %zu\n", taintSource);
1335
- executor.executeCheckTaintSource (
1336
- state, target, executor.makePointer (arguments[0 ]), taintSource);
1346
+
1347
+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1348
+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1349
+ if (p->isKnownValue ()) {
1350
+ pointer =
1351
+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1352
+ }
1353
+ }
1354
+ executor.executeCheckTaintSource (state, target, pointer, taintSource);
1337
1355
}
1338
1356
1339
1357
void SpecialFunctionHandler::handleGetTaintHits (
@@ -1347,9 +1365,15 @@ void SpecialFunctionHandler::handleGetTaintHits(
1347
1365
}
1348
1366
1349
1367
uint64_t taintSink = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
1350
- // printf("klee_get_taint_hits sink: %zu\n", taintSink);
1351
- executor.executeGetTaintHits (state, target,
1352
- executor.makePointer (arguments[0 ]), taintSink);
1368
+
1369
+ ref<PointerExpr> pointer = executor.makePointer (arguments[0 ]);
1370
+ if (auto *p = dyn_cast<PointerExpr>(arguments[0 ])) {
1371
+ if (p->isKnownValue ()) {
1372
+ pointer =
1373
+ PointerExpr::create (p->getValue (), p->getValue (), p->getTaint ());
1374
+ }
1375
+ }
1376
+ executor.executeGetTaintHits (state, target, pointer, taintSink);
1353
1377
}
1354
1378
1355
1379
void SpecialFunctionHandler::handleTaintHit (klee::ExecutionState &state,
@@ -1364,6 +1388,5 @@ void SpecialFunctionHandler::handleTaintHit(klee::ExecutionState &state,
1364
1388
1365
1389
uint64_t taintHits = dyn_cast<ConstantExpr>(arguments[0 ])->getZExtValue ();
1366
1390
size_t taintSink = dyn_cast<ConstantExpr>(arguments[1 ])->getZExtValue ();
1367
- // printf("klee_taint_hit hits: %zu sink: %zu\n", taintHits, taintSink);
1368
1391
executor.terminateStateOnTargetTaintError (state, taintHits, taintSink);
1369
1392
}
0 commit comments