about summary refs log tree commit diff
path: root/instrumentation/afl-llvm-common.cc
diff options
context:
space:
mode:
authorHuanyao Rong <r3tr0spect2019@qq.com>2024-06-21 21:03:37 -0700
committerNguyễn Gia Phong <cnx@loang.net>2024-12-03 11:17:44 +0900
commitd04bdf2e841fa6706c16bbba1cb6f6c73d647767 (patch)
tree23393adc733e6e9e61d7eb226c90258870bb0624 /instrumentation/afl-llvm-common.cc
parentcee3c86d7d5f0a05ad6cbb1434dc13162a16e336 (diff)
downloadafl++-d04bdf2e841fa6706c16bbba1cb6f6c73d647767.tar.gz
Implement AFLRun
References: https://github.com/Mem2019/AFLRun/commit/f5bb87f78ef1
References: https://github.com/Mem2019/AFLRun/commit/3af5f11b5644
Diffstat (limited to 'instrumentation/afl-llvm-common.cc')
-rw-r--r--instrumentation/afl-llvm-common.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/instrumentation/afl-llvm-common.cc b/instrumentation/afl-llvm-common.cc
index 5fcf27fb..d9744331 100644
--- a/instrumentation/afl-llvm-common.cc
+++ b/instrumentation/afl-llvm-common.cc
@@ -288,14 +288,18 @@ void scanForDangerousFunctions(llvm::Module *M) {
 
     StringRef ifunc_name = IF.getName();
     Constant *r = IF.getResolver();
-    StringRef r_name = cast<Function>(r->getOperand(0))->getName();
+    std::string r_name;
+    if (r->getNumOperands() > 0)
+      r_name = cast<Function>(r->getOperand(0))->getName().str();
+    else
+      r_name = "fucking_crash";
     if (!be_quiet)
       fprintf(stderr,
               "Note: Found an ifunc with name %s that points to resolver "
               "function %s, we will not instrument this, putting it into the "
               "block list.\n",
-              ifunc_name.str().c_str(), r_name.str().c_str());
-    denyListFunctions.push_back(r_name.str());
+              ifunc_name.str().c_str(), r_name.c_str());
+    denyListFunctions.push_back(r_name);
 
   }