[PATCH] D15098: Libfuzzer: do not pass null into user function

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 14:30:40 PST 2015


kcc accepted this revision.
kcc added a comment.
This revision is now accepted and ready to land.

LGTM with two nits.


================
Comment at: lib/Fuzzer/FuzzerLoop.cpp:242
@@ +241,3 @@
+  const uint8_t *Data = U.data();
+  static uint8_t EmptyData;
+  if (!Data) {
----------------
kcc wrote:
> aizatsky wrote:
> > kcc wrote:
> > > Looks weird. 
> > > I would prefer to have assert(!U.empty()) and enforce it in callers. 
> > There are too many paths that lead here. Plus, didn't we agree that its ok to call it with empty unit?
> Emm. I am probably not 100% convinced we want to call this with empty units. But ok, let's assume we can. 
> Now, remind me, why we can't call the target function as f(NULL, 0) ? 
no static?

================
Comment at: lib/Fuzzer/FuzzerLoop.cpp:243
@@ +242,3 @@
+  static uint8_t EmptyData;
+  if (!Data) {
+    Data = &EmptyData;
----------------
no {} ? 


http://reviews.llvm.org/D15098





More information about the llvm-commits mailing list