summaryrefslogtreecommitdiff
path: root/lib/fuzzer/afl/afl_driver.cpp
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-07-10 19:58:42 +0000
committerMatt Morehouse <mascasa@google.com>2018-07-10 19:58:42 +0000
commit06ddabbe180fc4f02d1ab16c207e808577a3c1dc (patch)
treea91dee846e7532a738aa350004d15f689028bf69 /lib/fuzzer/afl/afl_driver.cpp
parent1303b7bd0479ee64e9fa57ee146e73d7bdb8045a (diff)
Revert "[Fuzzer] Afl driver changing iterations handling"
This reverts rL334510 due to breakage of afl_driver's command line interface. Patch By: Jonathan Metzman Differential Revision: https://reviews.llvm.org/D49141 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/afl/afl_driver.cpp')
-rw-r--r--lib/fuzzer/afl/afl_driver.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/lib/fuzzer/afl/afl_driver.cpp b/lib/fuzzer/afl/afl_driver.cpp
index f3435ffd9..fa494c03b 100644
--- a/lib/fuzzer/afl/afl_driver.cpp
+++ b/lib/fuzzer/afl/afl_driver.cpp
@@ -59,7 +59,6 @@ statistics from the file. If that fails then the process will quit.
#include <sys/resource.h>
#include <sys/time.h>
#include <unistd.h>
-#include <limits.h>
#include <fstream>
#include <iostream>
@@ -306,18 +305,6 @@ int ExecuteFilesOnyByOne(int argc, char **argv) {
return 0;
}
-static void set_iterations(int *N, const char *arg) {
- char *next_char;
- long NL = strtol(arg, &next_char, 10);
- if (NL < 1 || NL > INT_MAX || *next_char != '\0') {
- fprintf(stderr, "WARNING: iterations invalid `%s`\n",
- arg);
- ::exit(-1);
- }
-
- *N = static_cast<int>(NL);
-}
-
int main(int argc, char **argv) {
fprintf(stderr,
"======================= INFO =========================\n"
@@ -344,12 +331,11 @@ int main(int argc, char **argv) {
int N = 1000;
if (argc == 2 && argv[1][0] == '-')
- set_iterations(&N, argv[1] + 1);
- else if(argc == 2) {
- fprintf(stderr, "WARNING: using the deprecated call style `%s %d`\n",
- argv[0], N);
- set_iterations(&N, argv[1]);
- } else if (argc > 1)
+ N = atoi(argv[1] + 1);
+ else if(argc == 2 && (N = atoi(argv[1])) > 0)
+ fprintf(stderr, "WARNING: using the deprecated call style `%s %d`\n",
+ argv[0], N);
+ else if (argc > 1)
return ExecuteFilesOnyByOne(argc, argv);
assert(N > 0);