blob: c1780d5c7bd9ad8fed2e0f73d019cb8c8ed035fc [file] [log] [blame]
Kostya Serebryany4d22e4f2016-08-30 01:30:14 +00001// 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
11static volatile int Sink;
12const int kArraySize = 1234567;
13int array[kArraySize];
14
15extern "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