blob: a07795a08dffa589a14f4a01fd54401de9f8b208 [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// Tests OOM handling.
5#include <assert.h>
6#include <cstddef>
7#include <cstdint>
8#include <cstdlib>
9#include <cstring>
10#include <iostream>
11
12static volatile char *SinkPtr;
13
14extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
15 if (Size > 0 && Data[0] == 'H') {
16 if (Size > 1 && Data[1] == 'i') {
17 if (Size > 2 && Data[2] == '!') {
18 size_t kSize = 0x20000000U;
19 char *p = new char[kSize];
20 SinkPtr = p;
21 delete [] p;
22 }
23 }
24 }
25 return 0;
26}
27