1 // This file is distributed under the University of Illinois Open Source
2 // License. See LICENSE.TXT for details.
3 
4 // Simple test for a fuzzer: find interesting value of array index.
5 #include <assert.h>
6 #include <cstdint>
7 #include <cstring>
8 #include <cstddef>
9 #include <iostream>
10 
11 static volatile int Sink;
12 const int kArraySize = 1234567;
13 int array[kArraySize];
14 
LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)15 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
16   if (Size < 8) return 0;
17   size_t a = 0;
18   memcpy(&a, Data, 8);
19   Sink = array[a % (kArraySize + 1)];
20   return 0;
21 }
22 
23