blob: 77d2cb1a25f9fe6a3e70f98b991c71c9507237f8 [file] [log] [blame]
George Karpenkov10ab2ac2017-08-21 23:25:50 +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. This test may trigger two different bugs.
5#include <cstddef>
6#include <cstdint>
7#include <cstdlib>
8#include <iostream>
9
10static volatile int *Null = 0;
11
12void Foo() { Null[1] = 0; }
13void Bar() { Null[2] = 0; }
14
15extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
16 if (Size < 10 && Data[0] == 'H')
17 Foo();
18 if (Size >= 10 && Data[0] == 'H')
19 Bar();
20 return 0;
21}
22