diff options
author | hexcoder- <heiko@hexco.de> | 2019-07-14 23:32:35 +0200 |
---|---|---|
committer | Heiko Eißfeldt <heiko@hexco.de> | 2019-07-15 08:54:12 +0200 |
commit | 2628f9f61b4c2c0dda8b830ceae504d78f8acf69 (patch) | |
tree | 8cb784951419bf9b5098294825b4dad63492993e /llvm_mode/compare-transform-pass.so.cc | |
parent | 0d217e15d59bf3286f6b428df21ef36e6e27b0dd (diff) | |
download | afl++-2628f9f61b4c2c0dda8b830ceae504d78f8acf69.tar.gz |
fix crash with case insensitive compare functions (str(n)casecmp())
Diffstat (limited to 'llvm_mode/compare-transform-pass.so.cc')
-rw-r--r-- | llvm_mode/compare-transform-pass.so.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm_mode/compare-transform-pass.so.cc b/llvm_mode/compare-transform-pass.so.cc index 95435db7..d0dbe8ec 100644 --- a/llvm_mode/compare-transform-pass.so.cc +++ b/llvm_mode/compare-transform-pass.so.cc @@ -257,6 +257,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, const std::vector<Value *> args; args.push_back(load); load = IRB.CreateCall(tolowerFn, args, "tmp"); + load = IRB.CreateTrunc(load, Int8Ty); } Value *isub; if (HasStr1) @@ -272,14 +273,9 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, const next_bb = BasicBlock::Create(C, "cmp_added", end_bb->getParent(), end_bb); BranchInst::Create(end_bb, next_bb); -#if LLVM_VERSION_MAJOR < 8 - TerminatorInst *term = cur_bb->getTerminator(); -#else - Instruction *term = cur_bb->getTerminator(); -#endif Value *icmp = IRB.CreateICmpEQ(isub, ConstantInt::get(Int8Ty, 0)); IRB.CreateCondBr(icmp, next_bb, end_bb); - term->eraseFromParent(); + cur_bb->getTerminator()->eraseFromParent(); } else { //IRB.CreateBr(end_bb); } |