about summary refs log tree commit diff
path: root/instrumentation
diff options
context:
space:
mode:
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/SanitizerCoveragePCGUARD.so.cc27
-rw-r--r--instrumentation/afl-llvm-dict2file.so.cc8
-rw-r--r--instrumentation/cmplog-instructions-pass.cc17
3 files changed, 41 insertions, 11 deletions
diff --git a/instrumentation/SanitizerCoveragePCGUARD.so.cc b/instrumentation/SanitizerCoveragePCGUARD.so.cc
index e234cf57..f80b1a1e 100644
--- a/instrumentation/SanitizerCoveragePCGUARD.so.cc
+++ b/instrumentation/SanitizerCoveragePCGUARD.so.cc
@@ -932,6 +932,15 @@ bool ModuleSanitizerCoverageAFL::InjectCoverage(
 
         IRBuilder<> IRB(callInst);
 
+        if (!FunctionGuardArray) {
+
+          fprintf(stderr,
+                  "SANCOV: FunctionGuardArray is NULL, failed to emit "
+                  "instrumentation.");
+          continue;
+
+        }
+
         Value *GuardPtr = IRB.CreateIntToPtr(
             IRB.CreateAdd(
                 IRB.CreatePointerCast(FunctionGuardArray, IntptrTy),
@@ -957,6 +966,15 @@ bool ModuleSanitizerCoverageAFL::InjectCoverage(
 
         if (t->getTypeID() == llvm::Type::IntegerTyID) {
 
+          if (!FunctionGuardArray) {
+
+            fprintf(stderr,
+                    "SANCOV: FunctionGuardArray is NULL, failed to emit "
+                    "instrumentation.");
+            continue;
+
+          }
+
           auto GuardPtr1 = IRB.CreateIntToPtr(
               IRB.CreateAdd(
                   IRB.CreatePointerCast(FunctionGuardArray, IntptrTy),
@@ -993,6 +1011,15 @@ bool ModuleSanitizerCoverageAFL::InjectCoverage(
                   FixedVectorType::get(Int32PtrTy, elements);
               Value *x, *y;
 
+              if (!FunctionGuardArray) {
+
+                fprintf(stderr,
+                        "SANCOV: FunctionGuardArray is NULL, failed to emit "
+                        "instrumentation.");
+                continue;
+
+              }
+
               Value *val1 = IRB.CreateIntToPtr(
                   IRB.CreateAdd(
                       IRB.CreatePointerCast(FunctionGuardArray, IntptrTy),
diff --git a/instrumentation/afl-llvm-dict2file.so.cc b/instrumentation/afl-llvm-dict2file.so.cc
index 79cdf491..31aaab07 100644
--- a/instrumentation/afl-llvm-dict2file.so.cc
+++ b/instrumentation/afl-llvm-dict2file.so.cc
@@ -536,15 +536,17 @@ bool AFLdict2filePass::runOnModule(Module &M) {
 
                 }
 
-                if (optLength > Str2.length()) { optLength = Str2.length(); }
-
               }
 
               valueMap[Str1P] = new std::string(Str2);
 
-              if (debug)
+              if (debug) {
+
                 fprintf(stderr, "Saved: %s for %p\n", Str2.c_str(),
                         (void *)Str1P);
+
+              }
+
               continue;
 
             }
diff --git a/instrumentation/cmplog-instructions-pass.cc b/instrumentation/cmplog-instructions-pass.cc
index 7c95d9bb..fd7930a1 100644
--- a/instrumentation/cmplog-instructions-pass.cc
+++ b/instrumentation/cmplog-instructions-pass.cc
@@ -515,7 +515,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
       while (1) {
 
         std::vector<Value *> args;
-        uint32_t             skip = 0;
+        bool                 skip = true;
 
         if (vector_cnt) {
 
@@ -537,16 +537,18 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
                         if (i0) {
 
                           cur_val = (uint64_t)i0->getValue().convertToDouble();
-                          if (last_val0 && last_val0 == cur_val) { skip = 1; }
-                          last_val0 = cur_val;
+                          if (last_val0 && last_val0 == cur_val) { skip = true;
+
+               } last_val0 = cur_val;
 
                         }
 
                         if (i1) {
 
                           cur_val = (uint64_t)i1->getValue().convertToDouble();
-                          if (last_val1 && last_val1 == cur_val) { skip = 1; }
-                          last_val1 = cur_val;
+                          if (last_val1 && last_val1 == cur_val) { skip = true;
+
+               } last_val1 = cur_val;
 
                         }
 
@@ -559,7 +561,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
             if (i0 && i0->uge(0xffffffffffffffff) == false) {
 
               cur_val = i0->getZExtValue();
-              if (last_val0 && last_val0 == cur_val) { skip = 1; }
+              if (last_val0 && last_val0 == cur_val) { skip = true; }
               last_val0 = cur_val;
 
             }
@@ -567,7 +569,7 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
             if (i1 && i1->uge(0xffffffffffffffff) == false) {
 
               cur_val = i1->getZExtValue();
-              if (last_val1 && last_val1 == cur_val) { skip = 1; }
+              if (last_val1 && last_val1 == cur_val) { skip = true; }
               last_val1 = cur_val;
 
             }
@@ -649,7 +651,6 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
 
         ++cur;
         if (cur >= vector_cnt) { break; }
-        skip = 0;
 
       }