blob: 7d1ebb0f6a4ab5cd82d57ca9f3864b1239feedbf [file] [log] [blame]
George Karpenkov10ab2ac2017-08-21 23:25:50 +00001// 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.
8extern "C" void LLVMFuzzerAnnounceOutput(const uint8_t *Data, size_t Size);
9extern "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}