1c5f01b2fSopenharmony_ci// This file is distributed under the University of Illinois Open Source 2c5f01b2fSopenharmony_ci// License. See LICENSE.TXT for details. 3c5f01b2fSopenharmony_ci 4c5f01b2fSopenharmony_ci// Simple test for a fuzzer. The fuzzer must find the string "FUZZ". 5c5f01b2fSopenharmony_ci#include <cstdint> 6c5f01b2fSopenharmony_ci#include <cstdlib> 7c5f01b2fSopenharmony_ci#include <cstddef> 8c5f01b2fSopenharmony_ci#include <iostream> 9c5f01b2fSopenharmony_ci 10c5f01b2fSopenharmony_ciextern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 11c5f01b2fSopenharmony_ci int bits = 0; 12c5f01b2fSopenharmony_ci if (Size > 0 && Data[0] == 'F') bits |= 1; 13c5f01b2fSopenharmony_ci if (Size > 1 && Data[1] == 'U') bits |= 2; 14c5f01b2fSopenharmony_ci if (Size > 2 && Data[2] == 'Z') bits |= 4; 15c5f01b2fSopenharmony_ci if (Size > 3 && Data[3] == 'Z') bits |= 8; 16c5f01b2fSopenharmony_ci if (bits == 15) { 17c5f01b2fSopenharmony_ci std::cerr << "BINGO!\n"; 18c5f01b2fSopenharmony_ci exit(1); 19c5f01b2fSopenharmony_ci } 20c5f01b2fSopenharmony_ci return 0; 21c5f01b2fSopenharmony_ci} 22c5f01b2fSopenharmony_ci 23