about summary refs log tree commit diff
path: root/src/afl-fuzz.c
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-09-18 10:22:55 +0200
committerGitHub <noreply@github.com>2019-09-18 10:22:55 +0200
commitb55ea6409dfcadf3c43244fb8e72ea660fd4fcc2 (patch)
tree8c2a81fde3312449b18cff1ab6ce27432db6e3e2 /src/afl-fuzz.c
parent68b3849d51e94e394334305b8ab7e4f613a8bbb9 (diff)
parent5e56d3bf368df07d964de769aa5142ad98536330 (diff)
downloadafl++-b55ea6409dfcadf3c43244fb8e72ea660fd4fcc2.tar.gz
Merge pull request #60 from vanhauser-thc/wine_mode
Wine mode
Diffstat (limited to 'src/afl-fuzz.c')
-rw-r--r--src/afl-fuzz.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index c2e18477..a2e3c873 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -53,7 +53,8 @@ static void usage(u8* argv0) {
       "  -t msec       - timeout for each run (auto-scaled, 50-%d ms)\n"
       "  -m megs       - memory limit for child process (%d MB)\n"
       "  -Q            - use binary-only instrumentation (QEMU mode)\n"
-      "  -U            - use Unicorn-based instrumentation (Unicorn mode)\n\n"
+      "  -U            - use unicorn-based instrumentation (Unicorn mode)\n"
+      "  -W            - use qemu-based instrumentation with Wine (Wine mode)\n"
       "  -L minutes    - use MOpt(imize) mode and set the limit time for "
       "entering the\n"
       "                  pacemaker mode (minutes of no new paths, 0 = "
@@ -131,7 +132,7 @@ int main(int argc, char** argv) {
   gettimeofday(&tv, &tz);
   init_seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
 
-  while ((opt = getopt(argc, argv, "+i:o:f:m:t:T:dnCB:S:M:x:QUe:p:s:V:E:L:h")) >
+  while ((opt = getopt(argc, argv, "+i:o:f:m:t:T:dnCB:S:M:x:QUWe:p:s:V:E:L:h")) >
          0)
 
     switch (opt) {
@@ -369,6 +370,16 @@ int main(int argc, char** argv) {
         if (!mem_limit_given) mem_limit = MEM_LIMIT_UNICORN;
 
         break;
+      
+      case 'W':                                             /* Wine+QEMU mode */
+
+        if (use_wine) FATAL("Multiple -W options not supported");
+        qemu_mode = 1;
+        use_wine = 1;
+
+        if (!mem_limit_given) mem_limit = 0;
+
+        break;
 
       case 'V': {
 
@@ -709,9 +720,14 @@ int main(int argc, char** argv) {
 
   start_time = get_cur_time();
 
-  if (qemu_mode)
-    use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
-  else
+  if (qemu_mode) {
+  
+    if (use_wine)
+      use_argv = get_wine_argv(argv[0], argv + optind, argc - optind);
+    else
+      use_argv = get_qemu_argv(argv[0], argv + optind, argc - optind);
+  
+  } else
     use_argv = argv + optind;
 
   perform_dry_run(use_argv);