diff options
author | nj00001 <42004790+nj00001@users.noreply.github.com> | 2023-04-03 15:32:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-03 15:32:52 +0800 |
commit | a01138e1c822b97cf187bfcad9938597bf3edc1e (patch) | |
tree | de36b6eadfbd873251853077f7fc344b65febbfb | |
parent | 319b2e8e6f64bd35c5395c8a9e5053f25875a86d (diff) | |
download | afl++-a01138e1c822b97cf187bfcad9938597bf3edc1e.tar.gz |
fix getOperand out of range
This commit fixes a sloppy function call that should normally check the number of insn's Operand before calling insn's getOperand method. The fix is that if it is 0 it should continue the loop. I solved problem https://github.com/AFLplusplus/AFLplusplus/issues/1688#issue-1648543691 using this modification
-rw-r--r-- | instrumentation/afl-llvm-common.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/instrumentation/afl-llvm-common.cc b/instrumentation/afl-llvm-common.cc index dc34d191..de334fb7 100644 --- a/instrumentation/afl-llvm-common.cc +++ b/instrumentation/afl-llvm-common.cc @@ -289,6 +289,9 @@ void scanForDangerousFunctions(llvm::Module *M) { StringRef ifunc_name = IF.getName(); Constant *r = IF.getResolver(); + if(r->getNumOperands() == 0){ + continue ; + } StringRef r_name = cast<Function>(r->getOperand(0))->getName(); if (!be_quiet) fprintf(stderr, |