about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-01-27 10:40:13 +0100
committervan Hauser <vh@thc.org>2020-01-27 10:40:13 +0100
commitfa64c0d4a5a6eb1eddd13071e3b326778bf6db5a (patch)
tree1c802b4b70b423fb920760aba6c79768fb874c99
parent3561a1b775989a0cf37221f810eec601cdb14bcf (diff)
downloadafl++-fa64c0d4a5a6eb1eddd13071e3b326778bf6db5a.tar.gz
important fixes for afl-cmin
-rwxr-xr-xafl-cmin28
1 files changed, 20 insertions, 8 deletions
diff --git a/afl-cmin b/afl-cmin
index de5a66ed..865809e1 100755
--- a/afl-cmin
+++ b/afl-cmin
@@ -292,6 +292,24 @@ BEGIN {
     exit 1
   }
 
+  # Check for the more efficient way to copy files...
+  if (0 != system("mkdir -p -m 0700 "trace_dir)) {
+    print "[-] Error: Cannot create directory "trace_dir > "/dev/stderr"
+    exit 1
+  }
+  if (0 != system("mkdir -p -m 0700 "trace_dir"/.state/auto_extras")) {
+    print "[-] Error: Cannot create directory "trace_dir"/.state/auto_extras" > "/dev/stderr"
+    exit 1
+  }
+  if (0 != system("mkdir -p -m 0700 "trace_dir"/.state/redundant_edges")) {
+    print "[-] Error: Cannot create directory "trace_dir"/.state/redundant_edges" > "/dev/stderr"
+    exit 1
+  }
+  if (0 != system("mkdir -p -m 0700 "trace_dir"/.state/deterministic_done")) {
+    print "[-] Error: Cannot create directory "trace_dir"/.state/deterministic_done" > "/dev/stderr"
+    exit 1
+  }
+
   if (stdin_file) {
     # truncate input file
     printf "" > stdin_file
@@ -339,12 +357,6 @@ BEGIN {
     exit 1
   }
 
-  # Check for the more efficient way to copy files...
-  if (0 != system("mkdir -p -m 0700 "trace_dir)) {
-    print "[-] Error: Cannot create directory "trace_dir > "/dev/stderr"
-    exit 1
-  }
-
   if (0 == system("ln "in_dir"/"first_file" "trace_dir"/.link_test")) {
     cp_tool = "ln"
   } else {
@@ -360,7 +372,7 @@ BEGIN {
     system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"/.run_test\" -Z "extra_par" -- \""target_bin"\" "prog_args_string" <\""in_dir"/"first_file"\"")
   } else {
     system("cp "in_dir"/"first_file" "stdin_file)
-    system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"/.run_test\" -Z "extra_par" -A \""stdin_file"\" -- \""target_bin"\" "prog_args_string" <dev/null")
+    system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"/.run_test\" -Z "extra_par" -A \""stdin_file"\" -- \""target_bin"\" "prog_args_string" < /dev/null")
   }
 
   first_count = 0
@@ -402,7 +414,7 @@ BEGIN {
       ++cur
       printf "\r    Processing file "cur"/"in_count
       system("cp "in_dir"/"fn" "stdin_file)
-      system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"/"fn"\" -Z "extra_par" -A \""stdin_file"\" -- \""target_bin"\" "prog_args_string" <dev/null")
+      system( "AFL_CMIN_ALLOW_ANY=1 \""showmap"\" -m "mem_limit" -t "timeout" -o \""trace_dir"/"fn"\" -Z "extra_par" -A \""stdin_file"\" -- \""target_bin"\" "prog_args_string" < /dev/null")
     }
   }