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 deep recursion. 5 // To generate a crashy input: 6 // for((i=0;i<110;i++)); do echo -n ABCDEFGHIJ >> INPUT; done 7 #include <cstddef> 8 #include <cstdint> 9 #include <cstdlib> 10 11 static volatile int Sink; 12 13 void Recursive(const uint8_t *Data, size_t Size, int Depth) { 14 if (Depth > 1000) abort(); 15 if (!Size) return; 16 if (*Data == ('A' + Depth % 10)) 17 Recursive(Data + 1, Size - 1, Depth + 1); 18 Sink++; 19 } 20 21 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 22 Recursive(Data, Size, 0); 23 return 0; 24 } 25 26