mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-11 17:51:32 +00:00
minor cmplog fix
This commit is contained in:
parent
686719cdca
commit
80bdbf7be0
@ -48,6 +48,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
|
||||
support (less performant than our own), GCC for old afl-gcc and
|
||||
CLANG for old afl-clang
|
||||
- fixed a potential crash in the LAF feature
|
||||
- workaround for llvm bitcast lto bug
|
||||
- workaround for llvm 13
|
||||
- qemuafl
|
||||
- QASan (address sanitizer for Qemu) ported to qemuafl!
|
||||
|
@ -266,13 +266,20 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
||||
unsigned int max_size = Val->getType()->getIntegerBitWidth(), cast_size;
|
||||
unsigned char do_cast = 0;
|
||||
|
||||
if (!SI->getNumCases() || max_size < 16 || max_size % 8) {
|
||||
if (!SI->getNumCases() || max_size < 16) {
|
||||
|
||||
// if (!be_quiet) errs() << "skip trivial switch..\n";
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (max_size % 8) {
|
||||
|
||||
max_size = (((max_size / 8) + 1) * 8);
|
||||
do_cast = 1;
|
||||
|
||||
}
|
||||
|
||||
IRBuilder<> IRB(SI->getParent());
|
||||
IRB.SetInsertPoint(SI);
|
||||
|
||||
@ -310,8 +317,10 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
||||
Value *CompareTo = Val;
|
||||
|
||||
if (do_cast) {
|
||||
|
||||
CompareTo =
|
||||
IRB.CreateIntCast(CompareTo, IntegerType::get(C, cast_size), false);
|
||||
|
||||
}
|
||||
|
||||
for (SwitchInst::CaseIt i = SI->case_begin(), e = SI->case_end(); i != e;
|
||||
@ -331,8 +340,10 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
||||
Value *new_param = cint;
|
||||
|
||||
if (do_cast) {
|
||||
|
||||
new_param =
|
||||
IRB.CreateIntCast(cint, IntegerType::get(C, cast_size), false);
|
||||
|
||||
}
|
||||
|
||||
if (new_param) {
|
||||
@ -490,7 +501,14 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
||||
|
||||
}
|
||||
|
||||
if (!max_size || max_size % 8 || max_size < 16) { continue; }
|
||||
if (!max_size || max_size < 16) { continue; }
|
||||
|
||||
if (max_size % 8) {
|
||||
|
||||
max_size = (((max_size / 8) + 1) * 8);
|
||||
do_cast = 1;
|
||||
|
||||
}
|
||||
|
||||
if (max_size > 128) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user