about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-08-01 15:44:56 +0200
committerGitHub <noreply@github.com>2019-08-01 15:44:56 +0200
commit54bb9f4b55f6707f0f5b211ce2d28ffcee705102 (patch)
tree01b6b4e123d208a5dab9144f98c48daf613107eb
parent487a87df02c20784bb4ef272954300dd18c04d9a (diff)
parentaf823d6486f9848ee8844f23ed3baf27da45a107 (diff)
downloadafl++-54bb9f4b55f6707f0f5b211ce2d28ffcee705102.tar.gz
Merge pull request #36 from vanhauser-thc/map_1mb
map size fixes
-rw-r--r--docs/ChangeLog1
-rw-r--r--llvm_mode/LLVMInsTrim.so.cc8
-rw-r--r--qemu_mode/patches/afl-qemu-cpu-inl.h2
3 files changed, 5 insertions, 6 deletions
diff --git a/docs/ChangeLog b/docs/ChangeLog
index dc1a3478..5e78610e 100644
--- a/docs/ChangeLog
+++ b/docs/ChangeLog
@@ -18,6 +18,7 @@ Version ++2.53d (dev):
 ----------------------
 
   - custom mutator by a loaded library is now supported (thanks to kyakdan!)
+  - fix for a few features to support different map sized than 2^16
   - afl-showmap: new option -r now shows the real values in the buckets (stock
     afl never did), plus shows tuple content summary information now
   - fix building on *BSD (thanks to tobias.kortkamp for the patch)
diff --git a/llvm_mode/LLVMInsTrim.so.cc b/llvm_mode/LLVMInsTrim.so.cc
index 81cf98c4..148f94c3 100644
--- a/llvm_mode/LLVMInsTrim.so.cc
+++ b/llvm_mode/LLVMInsTrim.so.cc
@@ -46,15 +46,13 @@ namespace {
     std::mt19937 generator;
     int total_instr = 0;
 
-    unsigned genLabel() {
-      return generator() % 65536;
+    unsigned int genLabel() {
+      return generator() &= MAP_SIZE - 1;
     }
 
   public:
     static char ID;
-    InsTrim() : ModulePass(ID), generator(0) {//}
-    
-//    AFLCoverage() : ModulePass(ID) {
+    InsTrim() : ModulePass(ID), generator(0) {
       char* instWhiteListFilename = getenv("AFL_LLVM_WHITELIST");
       if (instWhiteListFilename) {
         std::string line;
diff --git a/qemu_mode/patches/afl-qemu-cpu-inl.h b/qemu_mode/patches/afl-qemu-cpu-inl.h
index 03951fea..86203a5b 100644
--- a/qemu_mode/patches/afl-qemu-cpu-inl.h
+++ b/qemu_mode/patches/afl-qemu-cpu-inl.h
@@ -57,7 +57,7 @@
 
 /* This is equivalent to afl-as.h: */
 
-static unsigned char dummy[65536]; /* costs 64kb but saves a few instructions */
+static unsigned char dummy[MAP_SIZE]; /* costs MAP_SIZE but saves a few instructions */
 unsigned char *afl_area_ptr = dummy; /* Exported for afl_gen_trace */
 
 /* Exported variables populated by the code patched into elfload.c: */