llvm/lib/Fuzzer/test/SimpleFnAdapterTest.cpp
Mike Aizatsky d7ee221d4d [libfuzzer] arbitrary function adapter.
The adapter automates converting sequence of bytes into arbitrary
arguments.

Differential Revision: http://reviews.llvm.org/D17829

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262673 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03 23:45:29 +00:00

22 lines
489 B
C++

// Simple test for a fuzzer Fn adapter. The fuzzer has to find two non-empty
// vectors with the same content.
#include <iostream>
#include <vector>
#include "FuzzerFnAdapter.h"
static void TestFn(std::vector<uint8_t> V1, std::vector<uint8_t> V2) {
if (V1.size() > 0 && V1 == V2) {
std::cout << "BINGO; Found the target, exiting\n";
exit(0);
}
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
fuzzer::Adapt(TestFn, Data, Size);
return 0;
}