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// Test that we can find the minimal item in the corpus (3 bytes: "FUZ"). 5c5f01b2fSopenharmony_ci#include <cstdint> 6c5f01b2fSopenharmony_ci#include <cstdlib> 7c5f01b2fSopenharmony_ci#include <cstddef> 8c5f01b2fSopenharmony_ci#include <cstring> 9c5f01b2fSopenharmony_ci#include <cstdio> 10c5f01b2fSopenharmony_ci 11c5f01b2fSopenharmony_cistatic volatile uint32_t Sink; 12c5f01b2fSopenharmony_ci 13c5f01b2fSopenharmony_ciextern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 14c5f01b2fSopenharmony_ci if (Size < sizeof(uint32_t)) return 0; 15c5f01b2fSopenharmony_ci uint32_t X, Y; 16c5f01b2fSopenharmony_ci size_t Offset = Size < 8 ? 0 : Size / 2; 17c5f01b2fSopenharmony_ci memcpy(&X, Data + Offset, sizeof(uint32_t)); 18c5f01b2fSopenharmony_ci memcpy(&Y, "FUZZ", sizeof(uint32_t)); 19c5f01b2fSopenharmony_ci Sink = X == Y; 20c5f01b2fSopenharmony_ci return 0; 21c5f01b2fSopenharmony_ci} 22c5f01b2fSopenharmony_ci 23