[PATCH] Add a Fuzzer library
Yury Gribov
tetra2005 at gmail.com
Mon Jan 26 23:08:02 PST 2015
================
Comment at: lib/Fuzzer/FuzzerFlags.h:16
@@ +15,3 @@
+FUZZER_FLAG(int, iterations, -1,
+ "Number of iterations of the fuzzer (-1 for infinite runs).")
+FUZZER_FLAG(int, max_len, 64, "Maximal length of the test input.")
----------------
I wonder if people will mostly be interested to run fuzzer until coverage keeps increasing.
================
Comment at: lib/Fuzzer/FuzzerIO.cpp:19
@@ +18,3 @@
+ DIR *D = opendir(Dir.c_str());
+ if (!D) return V;
+ while (auto E = readdir(D)) {
----------------
Perhaps allow files as well?
================
Comment at: lib/Fuzzer/FuzzerLoop.cpp:118
@@ +117,3 @@
+ if (NewCoverage) {
+ Corpus.push_back(*U);
+ NewUnits++;
----------------
Just curious, have you considered making this a heap to explore the most covering units first?
================
Comment at: lib/Fuzzer/FuzzerMain.cpp:70
@@ +69,3 @@
+ if (Param[0] == '-' && strstr(Param + 1, Name) == Param + 1 &&
+ Param[Len + 1] == '=')
+ return &Param[Len + 2];
----------------
You know the len so perhaps just do memcmp for both checks?
================
Comment at: lib/Fuzzer/FuzzerMain.cpp:85
@@ +84,3 @@
+ std::cerr << "Flag: " << Name << " " << Val << "\n";
+ return true;;
+ }
----------------
Extra ;
================
Comment at: lib/Fuzzer/FuzzerMain.cpp:118
@@ +117,3 @@
+ if (!inputs.empty())
+ Options.OutputCorpus = inputs[0];
+ Fuzzer F(Options);
----------------
Perhaps add an option for this?
================
Comment at: lib/Fuzzer/FuzzerMutate.cpp:34
@@ +33,3 @@
+
+void Mutate(Unit *U, size_t MaxLen) {
+ assert(MaxLen > 0);
----------------
dblaikie wrote:
> pass U by reference?
Ditto for other places (CrossOver, MutateAndTestOne, etc.)?
================
Comment at: lib/Fuzzer/FuzzerUtil.cpp:56
@@ +55,3 @@
+ memset(&sigact, 0, sizeof(sigact));
+ sigact.sa_sigaction = AlarmHandler;
+ Res = sigaction(SIGALRM, &sigact, 0);
----------------
Don't you need SA_SIGINFO and perhaps SA_ONSTACK here?
http://reviews.llvm.org/D7184
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list