[PATCH] D38981: Added SpecialCastList fuzzer.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 17:11:45 PDT 2017


morehouse added inline comments.


================
Comment at: tools/llvm-special-case-list-fuzzer/special-case-list-fuzzer.cpp:16
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+  llvm::StringRef Ref((const char *)Data, Size);
+  std::unique_ptr<llvm::MemoryBuffer> Buf =
----------------
It is discouraged to store StringRefs unnecessarily.  See http://llvm.org/doxygen/classllvm_1_1StringRef.html#details.

In this case, you can probably just create the StringRef as an rvalue to the call below.

Also prefer `static_cast` over C-style cast.


================
Comment at: tools/llvm-special-case-list-fuzzer/special-case-list-fuzzer.cpp:21
+  if (!Buf)
+    exit(EXIT_FAILURE);
+
----------------
Fuzz targets should not exit.  See https://llvm.org/docs/LibFuzzer.html#fuzz-target.  Return instead.


https://reviews.llvm.org/D38981





More information about the llvm-commits mailing list