aboutsummaryrefslogtreecommitdiff
path: root/instrumentation
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-10-18 00:41:16 +0200
committervanhauser-thc <vh@thc.org>2021-10-18 00:41:16 +0200
commit6403fa4f70ebb9c475a5debe027e210b171f478e (patch)
tree108b9ab7286308e85b8ac27cba7937d0207c29b4 /instrumentation
parent9c278df0385afb03a078e25e27a4763512d8831a (diff)
downloadafl++-6403fa4f70ebb9c475a5debe027e210b171f478e.tar.gz
fix
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/cmplog-routines-pass.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/instrumentation/cmplog-routines-pass.cc b/instrumentation/cmplog-routines-pass.cc
index 854492b1..5dd5dc39 100644
--- a/instrumentation/cmplog-routines-pass.cc
+++ b/instrumentation/cmplog-routines-pass.cc
@@ -283,14 +283,21 @@ bool CmpLogRoutines::hookRtns(Module &M) {
FT->getParamType(0)->isPointerTy() &&
FT->getParamType(2)->isIntegerTy();
if (isPtrRtnN) {
- auto intTyOp = dyn_cast<IntegerType>(callInst->getArgOperand(2)->getType());
+
+ auto intTyOp =
+ dyn_cast<IntegerType>(callInst->getArgOperand(2)->getType());
if (intTyOp) {
- if (intTyOp->getBitWidth() != 32 && intTyOp->getBitWidth() != 64) {
+
+ if (intTyOp->getBitWidth() != 32 &&
+ intTyOp->getBitWidth() != 64) {
+
isPtrRtnN = false;
+
}
+
}
- }
+ }
bool isMemcmp =
(!FuncName.compare("memcmp") || !FuncName.compare("bcmp") ||
@@ -478,7 +485,10 @@ bool CmpLogRoutines::hookRtns(Module &M) {
std::vector<Value *> args;
Value * v1Pcasted = IRB.CreatePointerCast(v1P, i8PtrTy);
Value * v2Pcasted = IRB.CreatePointerCast(v2P, i8PtrTy);
- Value * v3Pcasted = IRB.CreateTruncOrBitCast(v3P, Int64Ty);
+ Value * v3Pbitcast = IRB.CreateBitCast(
+ v3P, IntegerType::get(C, v3P->getType()->getPrimitiveSizeInBits()));
+ Value *v3Pcasted =
+ IRB.CreateIntCast(v3Pbitcast, IntegerType::get(C, 64), false);
args.push_back(v1Pcasted);
args.push_back(v2Pcasted);
args.push_back(v3Pcasted);
@@ -533,7 +543,10 @@ bool CmpLogRoutines::hookRtns(Module &M) {
std::vector<Value *> args;
Value * v1Pcasted = IRB.CreatePointerCast(v1P, i8PtrTy);
Value * v2Pcasted = IRB.CreatePointerCast(v2P, i8PtrTy);
- Value * v3Pcasted = IRB.CreateTruncOrBitCast(v3P, Int64Ty);
+ Value * v3Pbitcast = IRB.CreateBitCast(
+ v3P, IntegerType::get(C, v3P->getType()->getPrimitiveSizeInBits()));
+ Value *v3Pcasted =
+ IRB.CreateIntCast(v3Pbitcast, IntegerType::get(C, 64), false);
args.push_back(v1Pcasted);
args.push_back(v2Pcasted);
args.push_back(v3Pcasted);