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

Ivan Krasin via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 17:14:06 PST 2015


krasin added a comment.

LGTM with a nit


================
Comment at: lib/Fuzzer/test/SimpleTest.cpp:11
@@ -9,2 +10,3 @@
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+  assert(Data);
   if (Size > 0 && Data[0] == 'H') {
----------------
Alternatively, you could #include "gtest/gtest.h" and use EXPECT_NE:

```
EXPECT_NE(NULL, Data) << "Pointer to the data must not be NULL"
```

EXPECT_NE will work even if LLVM is built without asserts, while assert will just pass.


http://reviews.llvm.org/D15098





More information about the llvm-commits mailing list