aboutsummaryrefslogtreecommitdiff
path: root/instrumentation
diff options
context:
space:
mode:
authornj00001 <42004790+nj00001@users.noreply.github.com>2023-04-03 15:32:52 +0800
committerGitHub <noreply@github.com>2023-04-03 15:32:52 +0800
commita01138e1c822b97cf187bfcad9938597bf3edc1e (patch)
treede36b6eadfbd873251853077f7fc344b65febbfb /instrumentation
parent319b2e8e6f64bd35c5395c8a9e5053f25875a86d (diff)
downloadAFLplusplus-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
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/afl-llvm-common.cc3
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,