diff options
author | van Hauser <vh@thc.org> | 2021-01-04 18:20:02 +0100 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2021-01-04 18:20:02 +0100 |
commit | 5c224726169e421e95ec7f926f7808ff78cb05df (patch) | |
tree | 9cecd39bef7f949c99a18584bacd68fb963da349 | |
parent | b7cd6d4035f18a50fd664eb8bb3829e9a4aeb9c3 (diff) | |
download | afl++-5c224726169e421e95ec7f926f7808ff78cb05df.tar.gz |
cmplog fix
-rw-r--r-- | instrumentation/cmplog-instructions-pass.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc index 841ba0bd..154bec2b 100644 --- a/instrumentation/cmplog-instructions-pass.cc +++ b/instrumentation/cmplog-instructions-pass.cc @@ -249,11 +249,20 @@ bool CmpLogInstructions::hookInstrs(Module &M) { intTyOp0 = dyn_cast<IntegerType>(V0->getType()); Value *V1 = IRB.CreateBitCast(op1, IntegerType::get(C, max_size)); intTyOp1 = dyn_cast<IntegerType>(V1->getType()); - max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() + + if (intTyOp0 && intTyOp1) { + + max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() ? intTyOp0->getBitWidth() : intTyOp1->getBitWidth(); - args.push_back(V0); - args.push_back(V1); + args.push_back(V0); + args.push_back(V1); + + } else { + + max_size = 0; + + } } @@ -261,11 +270,16 @@ bool CmpLogInstructions::hookInstrs(Module &M) { intTyOp0 = dyn_cast<IntegerType>(op0->getType()); intTyOp1 = dyn_cast<IntegerType>(op1->getType()); - max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() - ? intTyOp0->getBitWidth() - : intTyOp1->getBitWidth(); - args.push_back(op0); - args.push_back(op1); + + if (intTyOp0 && intTyOp1) { + + max_size = intTyOp0->getBitWidth() > intTyOp1->getBitWidth() + ? intTyOp0->getBitWidth() + : intTyOp1->getBitWidth(); + args.push_back(op0); + args.push_back(op1); + + } } |