1// This file is distributed under the University of Illinois Open Source 2// License. See LICENSE.TXT for details. 3 4// Test that libFuzzer itself does not read out of bounds. 5#include <assert.h> 6#include <cstdint> 7#include <cstring> 8#include <cstdlib> 9#include <cstddef> 10#include <iostream> 11 12static volatile int Sink; 13 14extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 15 if (Size < 5) return 0; 16 const char *Ch = reinterpret_cast<const char *>(Data); 17 if (Ch[Size - 3] == 'a') 18 Sink = strncmp(Ch + Size - 3, "abcdefg", 6); 19 return 0; 20} 21 22