https://github.com/tetsuok/libfuzzer-exercise-macos
https://github.com/tetsuok/libfuzzer-exercise-macos
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tetsuok/libfuzzer-exercise-macos
- Owner: tetsuok
- License: bsd-3-clause
- Created: 2017-03-18T16:17:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-18T18:09:18.000Z (over 9 years ago)
- Last Synced: 2025-02-15T05:51:38.349Z (over 1 year ago)
- Language: C++
- Size: 5.86 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
libfuzzer-exercise-macos
========================
This repo holds the scripts to setup
[libFuzzer](http://llvm.org/docs/LibFuzzer.html) on macOS.
### Setup
```
$ make install
$ make check # to make sure libFuzzer can be used
```
### Fuzz target
Write a function to do fuzzing your API.
```
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
TestYourAPI(Data, Size);
return 0;
}
```
Compile with `-fsanitize=address -fsanitize-coverage=trace-pc-guard`,
linking with `libFuzzer.a`.
```
$ ./clang-driver -std=c++11 -g -fno-omit-frame-pointer -fsanitize=address -fsanitize-coverage=trace-pc-guard //path/to/your_fuzzer.cc libFuzzer.a -o your_fuzzer
$ ./your_fuzzer -max_total_time=300 # the fuzzer will run indefinitely if without bugs
```
See test/test_fuzzer.cc as an example.
See for more details.