1 // This file is distributed under the University of Illinois Open Source 2 // License. See LICENSE.TXT for details. 3 #include <stddef.h> 4 #include <stdint.h> 5 #include <stdio.h> 6 7 // Test for libFuzzer's "equivalence" fuzzing, part B. 8 extern "C" void LLVMFuzzerAnnounceOutput(const uint8_t *Data, size_t Size); 9 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 10 // fprintf(stderr, "B %zd\n", Size); 11 uint8_t Result[50]; 12 if (Size > 50) Size = 50; 13 for (size_t i = 0; i < Size; i++) 14 Result[Size - i - 1] = Data[i]; 15 16 // Be a bit different from EquivalenceATest 17 if (Size > 10 && Data[5] == 'B' && Data[6] == 'C' && Data[7] == 'D') { 18 static int c; 19 if (!c) 20 fprintf(stderr, "ZZZZZZZ\n"); 21 c = 1; 22 Result[2]++; 23 } 24 25 LLVMFuzzerAnnounceOutput(Result, Size); 26 return 0; 27 } 28