about summary refs log tree commit diff
path: root/llvm_mode
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-07-03 19:10:48 +0200
committervan Hauser <vh@thc.org>2019-07-03 19:10:48 +0200
commit04c92c84705af4c602f134ed9a63b82be5ef75c9 (patch)
tree71fb515695bfe24cd5fbfb08218f5506638c5167 /llvm_mode
parent00b22e37df4a4dff32cfe0037de1550c1917387f (diff)
downloadafl++-04c92c84705af4c602f134ed9a63b82be5ef75c9.tar.gz
notzero for afl-gcc
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index b77835c5..6b2232f2 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -287,6 +287,16 @@ bool AFLCoverage::runOnModule(Module &M) {
              Value *HowMuch = IRB.CreateAdd(ConstantInt::get(Int8Ty, 1), cf);
              Incr = IRB.CreateAdd(Counter, HowMuch);
 
+          } else if (neverZero_counters_str[0] == '5') {
+            auto cf = IRB.CreateICmpEQ(Incr, ConstantInt::get(Int8Ty, 0));
+            auto carry = IRB.CreateZExt(cf, Int8Ty);
+            Incr = IRB.CreateAdd(Incr, carry);
+
+          } else if (neverZero_counters_str[0] == '6') {
+            auto cf = IRB.CreateICmpULT(Incr, ConstantInt::get(Int8Ty, 1));
+            auto carry = IRB.CreateZExt(cf, Int8Ty);
+            Incr = IRB.CreateAdd(Incr, carry);
+           
           // no other implementations yet
           } else {
             fprintf(stderr, "Error: unknown value for AFL_NZERO_COUNTS: %s (valid is 1-4)\n", neverZero_counters_str);