[PATCH] D50194: LLVM Proto Fuzzer - Run Functions on Suite of Inputs

Matt Morehouse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 2 10:35:37 PDT 2018


morehouse added inline comments.


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/handle_llvm.cpp:173
+  int s = getSize((char *) func_ptr);
+  memcpy(mem, func_ptr, s);
+}
----------------
Why do we need to copy the function somewhere else?  Looks very error-prone and unnecessary.  Also makes this patch larger than it needs to be.


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/input_arrays.cpp:30
+  memcpy(b2, InputArrays[b_index], ArraySize * sizeof(int));
+  memcpy(c2, InputArrays[c_index], ArraySize * sizeof(int));
+}
----------------
Do the generated functions ever modify arrays a and b, or just c?  If just c, we can avoid lots of memcpys here.


================
Comment at: clang/tools/clang-fuzzer/handle-llvm/input_arrays.h:34
+// Define a corpus of possible inputs
+static int InputArrays[100][64] =
+{ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
----------------
Use the constants you just defined.


Repository:
  rC Clang

https://reviews.llvm.org/D50194





More information about the cfe-commits mailing list