llvm.org GIT mirror llvm / d0a8230
[llvm-special-case-list-fuzzer] Add fuzz target. Summary: Create a fuzzer for sanitizer blacklists. Patch by: hctim Reviewers: morehouse Reviewed By: morehouse Subscribers: llvm-commits, mgorny, kcc Differential Revision: https://review.llvm.org/D38981 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316014 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Morehouse 2 years ago
3 changed file(s) with 53 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 set(LLVM_LINK_COMPONENTS
1 Support
2 FuzzMutate
3 )
4
5 add_llvm_fuzzer(llvm-special-case-list-fuzzer
6 special-case-list-fuzzer.cpp
7 DUMMY_MAIN DummySpecialCaseListFuzzer.cpp)
0 //===--- DummySpecialCaseListFuzzer.cpp -----------------------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Implementation of main so we can build and test without linking libFuzzer.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/FuzzMutate/FuzzerCLI.h"
14
15 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
16 int main(int argc, char *argv[]) {
17 return llvm::runFuzzerOnInputs(argc, argv, LLVMFuzzerTestOneInput);
18 }
0 //===--- special-case-list-fuzzer.cpp - Fuzzer for special case lists -----===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Support/MemoryBuffer.h"
10 #include "llvm/Support/SpecialCaseList.h"
11
12 #include
13
14 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
15 std::unique_ptr Buf = llvm::MemoryBuffer::getMemBuffer(
16 llvm::StringRef(reinterpret_cast(Data), Size), "", false);
17
18 if (!Buf)
19 return 0;
20
21 std::string Error;
22 llvm::SpecialCaseList::create(Buf.get(), Error);
23
24 return 0;
25 }