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 A.
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, "A %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   LLVMFuzzerAnnounceOutput(Result, Size);
16   return 0;
17 }
18