From d04bdf2e841fa6706c16bbba1cb6f6c73d647767 Mon Sep 17 00:00:00 2001 From: Huanyao Rong Date: Fri, 21 Jun 2024 21:03:37 -0700 Subject: Implement AFLRun References: https://github.com/Mem2019/AFLRun/commit/f5bb87f78ef1 References: https://github.com/Mem2019/AFLRun/commit/3af5f11b5644 --- instrumentation/afl-llvm-common.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'instrumentation/afl-llvm-common.cc') 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(r->getOperand(0))->getName(); + std::string r_name; + if (r->getNumOperands() > 0) + r_name = cast(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); } -- cgit 1.4.1