1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2// See https://llvm.org/LICENSE.txt for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4#include <stddef.h>
5#include <stdint.h>
6#include <stdio.h>
7
8// Test for libFuzzer's "equivalence" fuzzing, part A.
9extern "C" void LLVMFuzzerAnnounceOutput(const uint8_t *Data, size_t Size);
10extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
11 // fprintf(stderr, "A %zd\n", Size);
12 uint8_t Result[50];
13 if (Size > 50) Size = 50;
14 for (size_t i = 0; i < Size; i++)
15 Result[Size - i - 1] = Data[i];
16 LLVMFuzzerAnnounceOutput(Data: Result, Size);
17 return 0;
18}
19

source code of compiler-rt/test/fuzzer/EquivalenceATest.cpp