1 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2 // See https://llvm.org/LICENSE.txt for license information.
3 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 // Simple test for a fuzzer.
6 // Here the target has a shallow OOM bug and a deeper crash.
7 // Make sure we can find the crash while ignoring OOMs.
11 static volatile int *Sink
;
12 static volatile int *Zero
;
14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data
, size_t Size
) {
15 if (Size
>= 3 && Data
[0] == 'O' && Data
[1] == 'O' && Data
[2] == 'M')
16 Sink
= new int[1 << 28]; // instant OOM with -rss_limit_mb=128.
17 if (Size
>= 4 && Data
[0] == 'F' && Data
[1] == 'U' && Data
[2] == 'Z' &&
18 Data
[3] == 'Z') // a bit deeper crash.