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. The fuzzer must find the interesting switch value.
5 #include <cstddef>
6 #include <cstdint>
7 #include <cstdio>
8 #include <cstdlib>
9 #include <cstring>
10 
11 static volatile int Sink;
12 
13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
14   uint32_t v;
15   if (Size < 100) return 0;
16   memcpy(&v, Data + Size / 2, sizeof(v));
17   switch(v) {
18     case 0x47524159: abort();
19     case 0x52474220: abort();
20     default:;
21   }
22   return 0;
23 }
24 
25