[PATCH] D12723: llvm-mc-fuzzer: A fuzzing tool for the MC layer.

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 09:52:22 PDT 2015


kcc added a subscriber: kcc.
kcc added a comment.

Nice!

Could you please also add a line about your findings 
to http://llvm.org/docs/LibFuzzer.html#trophies
(or tell me what to add there) ?

Once committed, I'll add it to the fuzzer bot: 
lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer


================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:22
@@ +21,3 @@
+
+#define CHAR_BUF_SIZE 80
+
----------------
please use a C++ constant

================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:62
@@ +61,3 @@
+
+  uint8_t *DataCopy = new uint8_t[Size];
+  memcpy(DataCopy, Data, Size);
----------------
why not vector? 

================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:81
@@ +80,3 @@
+
+int main(int argc, char **argv) {
+  LLVMInitializeAllTargetInfos();
----------------
Since the command line is unusual (compared to other uses of libFuzzer) 
please add a comment with usage example(s)

================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:103
@@ +102,3 @@
+    strcpy(Arg, I.c_str());
+    FuzzerArgv.push_back(Arg);
+  }
----------------
Do you really need to copy these here? 
Why not just pass I.c_str()? 

================
Comment at: tools/llvm-mc-fuzzer/llvm-mc-fuzzer.cpp:109
@@ +108,3 @@
+  if (Action == AC_Assemble)
+    errs() << "error: -assemble is not implemented\n";
+  else if (Action == AC_Disassemble)
----------------
Do you need it to be this complex? 
For assembling you can write a separate target binary


http://reviews.llvm.org/D12723





More information about the llvm-commits mailing list