mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 11:08:06 +00:00
fix crash with case insensitive compare functions (str(n)casecmp())
This commit is contained in:
committed by
Heiko Eißfeldt
parent
0d217e15d5
commit
2628f9f61b
@ -257,6 +257,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp, const
|
|||||||
std::vector<Value *> args;
|
std::vector<Value *> args;
|
||||||
args.push_back(load);
|
args.push_back(load);
|
||||||
load = IRB.CreateCall(tolowerFn, args, "tmp");
|
load = IRB.CreateCall(tolowerFn, args, "tmp");
|
||||||
|
load = IRB.CreateTrunc(load, Int8Ty);
|
||||||
}
|
}
|
||||||
Value *isub;
|
Value *isub;
|
||||||
if (HasStr1)
|
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);
|
next_bb = BasicBlock::Create(C, "cmp_added", end_bb->getParent(), end_bb);
|
||||||
BranchInst::Create(end_bb, next_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));
|
Value *icmp = IRB.CreateICmpEQ(isub, ConstantInt::get(Int8Ty, 0));
|
||||||
IRB.CreateCondBr(icmp, next_bb, end_bb);
|
IRB.CreateCondBr(icmp, next_bb, end_bb);
|
||||||
term->eraseFromParent();
|
cur_bb->getTerminator()->eraseFromParent();
|
||||||
} else {
|
} else {
|
||||||
//IRB.CreateBr(end_bb);
|
//IRB.CreateBr(end_bb);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user