LLVM  5.0.0
FourIndependentBranchesTest.cpp
Go to the documentation of this file.
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 string "FUZZ".
5 #include <cstddef>
6 #include <cstdint>
7 #include <cstdlib>
8 #include <iostream>
9 
10 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
11  if (Size > 64) return 0;
12  int bits = 0;
13  if (Size > 0 && Data[0] == 'F') bits |= 1;
14  if (Size > 1 && Data[1] == 'U') bits |= 2;
15  if (Size > 2 && Data[2] == 'Z') bits |= 4;
16  if (Size > 3 && Data[3] == 'Z') bits |= 8;
17  if (bits == 15) {
18  std::cerr << "BINGO!\n";
19  exit(1);
20  }
21  return 0;
22 }
23 
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
demanded bits
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.