[llvm] r295117 - [libFuzzer] increase the size of FixedWord from 27 to 64, see PR31950

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 15:02:38 PST 2017


Author: kcc
Date: Tue Feb 14 17:02:37 2017
New Revision: 295117

URL: http://llvm.org/viewvc/llvm-project?rev=295117&view=rev
Log:
[libFuzzer] increase the size of FixedWord from 27 to 64, see PR31950

Added:
    llvm/trunk/lib/Fuzzer/test/Memcmp64BytesTest.cpp
Modified:
    llvm/trunk/lib/Fuzzer/FuzzerDictionary.h
    llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
    llvm/trunk/lib/Fuzzer/test/fuzzer-traces-hooks.test

Modified: llvm/trunk/lib/Fuzzer/FuzzerDictionary.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDictionary.h?rev=295117&r1=295116&r2=295117&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDictionary.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDictionary.h Tue Feb 14 17:02:37 2017
@@ -51,7 +51,7 @@ private:
   uint8_t Data[kMaxSize];
 };
 
-typedef FixedWord<27> Word; // 28 bytes.
+typedef FixedWord<64> Word;
 
 class DictionaryEntry {
  public:

Modified: llvm/trunk/lib/Fuzzer/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/CMakeLists.txt?rev=295117&r1=295116&r2=295117&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/CMakeLists.txt (original)
+++ llvm/trunk/lib/Fuzzer/test/CMakeLists.txt Tue Feb 14 17:02:37 2017
@@ -90,6 +90,7 @@ set(Tests
   FourIndependentBranchesTest
   FullCoverageSetTest
   InitializeTest
+  Memcmp64BytesTest
   MemcmpTest
   LeakTest
   LeakTimeoutTest

Added: llvm/trunk/lib/Fuzzer/test/Memcmp64BytesTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/Memcmp64BytesTest.cpp?rev=295117&view=auto
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/Memcmp64BytesTest.cpp (added)
+++ llvm/trunk/lib/Fuzzer/test/Memcmp64BytesTest.cpp Tue Feb 14 17:02:37 2017
@@ -0,0 +1,20 @@
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+
+// Simple test for a fuzzer. The fuzzer must find a particular string.
+#include <cassert>
+#include <cstring>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+  const char kString64Bytes[] =
+      "123456789 123456789 123456789 123456789 123456789 123456789 1234";
+  assert(sizeof(kString64Bytes) == 65);
+  if (Size >= 64 && memcmp(Data, kString64Bytes, 64) == 0) {
+    fprintf(stderr, "BINGO\n");
+    exit(1);
+  }
+  return 0;
+}

Modified: llvm/trunk/lib/Fuzzer/test/fuzzer-traces-hooks.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-traces-hooks.test?rev=295117&r1=295116&r2=295117&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-traces-hooks.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-traces-hooks.test Tue Feb 14 17:02:37 2017
@@ -9,6 +9,8 @@ RUN: not LLVMFuzzer-StrncmpTest
 RUN: not LLVMFuzzer-StrcmpTest               -seed=1 -runs=2000000   2>&1 | FileCheck %s
 RUN: not LLVMFuzzer-StrstrTest               -seed=1 -runs=2000000   2>&1 | FileCheck %s
 
+RUN: not LLVMFuzzer-Memcmp64BytesTest        -seed=1 -runs=10000   2>&1 | FileCheck %s
+
 RUN: LLVMFuzzer-RepeatedMemcmp -seed=11 -runs=100000 2>&1 | FileCheck %s --check-prefix=RECOMMENDED_DICT
 RECOMMENDED_DICT:###### Recommended dictionary. ######
 RECOMMENDED_DICT-DAG: "foo"




More information about the llvm-commits mailing list