[lib/Fuzzer] rename TestOneInput to LLVMFuzzerTestOneInput to make it more unique
authorKostya Serebryany <kcc@google.com>
Wed, 6 May 2015 22:19:00 +0000 (22:19 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 6 May 2015 22:19:00 +0000 (22:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236652 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
docs/LibFuzzer.rst
lib/Fuzzer/FuzzerMain.cpp
lib/Fuzzer/dfsan_fuzzer_abi.list
lib/Fuzzer/test/CounterTest.cpp
lib/Fuzzer/test/CxxTokensTest.cpp
lib/Fuzzer/test/FourIndependentBranchesTest.cpp
lib/Fuzzer/test/FullCoverageSetTest.cpp
lib/Fuzzer/test/FuzzerUnittest.cpp
lib/Fuzzer/test/InfiniteTest.cpp
lib/Fuzzer/test/NullDerefTest.cpp
lib/Fuzzer/test/SimpleTest.cpp
lib/Fuzzer/test/TimeoutTest.cpp
lib/Fuzzer/test/dfsan/DFSanSimpleCmpTest.cpp

index 383f888f9f485a5995bf8c38214067015ceb8290..f848021ef135e124b9fbd886f6890fa3db33984b 100644 (file)
@@ -20,7 +20,7 @@ This library is intended primarily for in-process coverage-guided fuzz testing
   optimizations options (e.g. -O0, -O1, -O2) to diversify testing.
 * Build a test driver using the same options as the library.
   The test driver is a C/C++ file containing interesting calls to the library
-  inside a single function  ``extern "C" void TestOneInput(const uint8_t *Data, size_t Size);``
+  inside a single function  ``extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);``
 * Link the Fuzzer, the library and the driver together into an executable
   using the same sanitizer options as for the library.
 * Collect the initial corpus of inputs for the
@@ -56,7 +56,7 @@ Toy example
 A simple function that does something interesting if it receives the input "HI!"::
 
   cat << EOF >> test_fuzzer.cc
-  extern "C" void TestOneInput(const unsigned char *data, unsigned long size) {
+  extern "C" void LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) {
     if (size > 0 && data[0] == 'H')
       if (size > 1 && data[1] == 'I')
          if (size > 2 && data[2] == '!')
@@ -92,7 +92,7 @@ Here we show how to use lib/Fuzzer on something real, yet simple: pcre2_::
   cat << EOF > pcre_fuzzer.cc
   #include <string.h>
   #include "pcre2posix.h"
-  extern "C" void TestOneInput(const unsigned char *data, size_t size) {
+  extern "C" void LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
     if (size < 1) return;
     char *str = new char[size+1];
     memcpy(str, data, size);
@@ -196,7 +196,7 @@ to find Heartbleed with LibFuzzer::
     assert (SSL_CTX_use_PrivateKey_file(sctx, "server.key", SSL_FILETYPE_PEM));
     return 0;
   }
-  extern "C" void TestOneInput(unsigned char *Data, size_t Size) {
+  extern "C" void LLVMFuzzerTestOneInput(unsigned char *Data, size_t Size) {
     static int unused = Init();
     SSL *server = SSL_new(sctx);
     BIO *sinbio = BIO_new(BIO_s_mem());
@@ -259,7 +259,7 @@ Periodically restart both fuzzers so that they can use each other's findings.
 How good is my fuzzer?
 ----------------------
 
-Once you implement your target function ``TestOneInput`` and fuzz it to death,
+Once you implement your target function ``LLVMFuzzerTestOneInput`` and fuzz it to death,
 you will want to know whether the function or the corpus can be improved further.
 One easy to use metric is, of course, code coverage.
 You can get the coverage for your corpus like this::
index d0c3df3b6b51e6e78a70fedd51ee17da30d980bb..c4dffb45d166af62643e0368e04239c4c11337c6 100644 (file)
@@ -13,8 +13,8 @@
 #include "FuzzerInternal.h"
 
 // This function should be defined by the user.
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size);
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
 
 int main(int argc, char **argv) {
-  return fuzzer::FuzzerDriver(argc, argv, TestOneInput);
+  return fuzzer::FuzzerDriver(argc, argv, LLVMFuzzerTestOneInput);
 }
index 7da752278f79e0a4935f0b4d124de9daf66cdf8a..6cc684368a63de69d02be4bdb7838127f70b3b91 100644 (file)
@@ -9,4 +9,4 @@ fun:__sanitizer_cov_module_init=uninstrumented
 fun:__sanitizer_cov_module_init=discard
 
 # Don't add extra parameters to the Fuzzer callback.
-fun:TestOneInput=uninstrumented
+fun:LLVMFuzzerTestOneInput=uninstrumented
index 332ccfe7b029cd62b6b30bef39014fb567a0b64f..29ddb02ebaea3ecbbfc0163135d497a3d6fb0ab3 100644 (file)
@@ -2,7 +2,7 @@
 // executed many times.
 #include <iostream>
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   int Num = 0;
   for (size_t i = 0; i < Size; i++)
     if (Data[i] == 'A' + i)
index 1addccb4bf92daa08b3350dac791ab3758539574..682ceb4f978a7135db371be860d9c29cfb85960f 100644 (file)
@@ -10,7 +10,7 @@ static void Found() {
   exit(1);
 }
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   // looking for "thread_local unsigned A;"
   if (Size < 24) return;
   if (0 == memcmp(&Data[0], "thread_local", 12))
index 171668bf7645497a2faa9f2c412b9a30333fc75e..e0b7509b8d65f2865ed6bbf867c7f935380e9a7e 100644 (file)
@@ -4,7 +4,7 @@
 #include <cstddef>
 #include <iostream>
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   int bits = 0;
   if (Size > 0 && Data[0] == 'F') bits |= 1;
   if (Size > 1 && Data[1] == 'U') bits |= 2;
index d4f8c115abc1c4d1740fb394422391aaaac98dbe..2c6ff98db0055bc7e11a801c09db4105eb672cc2 100644 (file)
@@ -4,7 +4,7 @@
 #include <cstddef>
 #include <iostream>
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   int bits = 0;
   if (Size > 0 && Data[0] == 'F') bits |= 1;
   if (Size > 1 && Data[1] == 'U') bits |= 2;
index 368a0f2bf00371d0ba75612e8a9aea0a95c381d1..e337ca851bfc524818b28bb4575c6e13820322cf 100644 (file)
@@ -2,9 +2,9 @@
 #include "gtest/gtest.h"
 #include <set>
 
-// For now, have TestOneInput just to make it link.
-// Later we may want to make unittests that actually call TestOneInput.
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+// For now, have LLVMFuzzerTestOneInput just to make it link.
+// Later we may want to make unittests that actually call LLVMFuzzerTestOneInput.
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   abort();
 }
 
index dcb3030413b9953ac7a16f177d6789913416df5c..7c5c8c1271372f416612b5f0842ed6d3c3a91495 100644 (file)
@@ -6,7 +6,7 @@
 
 static volatile int Sink;
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 0 && Data[0] == 'H') {
     Sink = 1;
     if (Size > 1 && Data[1] == 'i') {
index 8811e386f9d3000e0637a2f4904ffaa26dad7a2c..0cff6617a31d07beca8781a4b6889276996d3e1f 100644 (file)
@@ -7,7 +7,7 @@
 static volatile int Sink;
 static volatile int *Null = 0;
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 0 && Data[0] == 'H') {
     Sink = 1;
     if (Size > 1 && Data[1] == 'i') {
index adb90cebe86bea240a0c1244d6e02615708799e5..4e3501882d08e35642114d21b9c3205407bb9292 100644 (file)
@@ -6,7 +6,7 @@
 
 static volatile int Sink;
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 0 && Data[0] == 'H') {
     Sink = 1;
     if (Size > 1 && Data[1] == 'i') {
index 23683ce866c234bd86271696c82b528a5e91b4ef..d541c058b648f86105f91405184c5f0ba6f81b84 100644 (file)
@@ -6,7 +6,7 @@
 
 static volatile int Sink;
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 0 && Data[0] == 'H') {
     Sink = 1;
     if (Size > 1 && Data[1] == 'i') {
index 11620929a429a7adab18218b40eb313233f20c9e..d94d1defa00da448116301e4bbc7c827b1392048 100644 (file)
@@ -4,7 +4,7 @@
 #include <cstring>
 #include <cstdio>
 
-extern "C" void TestOneInput(const uint8_t *Data, size_t Size) {
+extern "C" void LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size < 14) return;
   uint64_t x = 0;
   int64_t  y = 0;