blob: 8cde0294010f61b2171c5a470b4de3c64ef3b00c [file] [log] [blame] [view]
Hasnain Lakhani37f4e0d2025-08-25 11:21:33 -07001# C++ Fuzzing README
2
3To build the fuzz targets, run `make check` in this directory. The build system uses LLVM's libFuzzer for fuzzing the C++ Thrift implementation.
4
5These are standard libFuzzer targets, so you can run them using the standard libFuzzer interface. After building, you can run a fuzzer using:
6```bash
7./<fuzzer_name>
8```
9
10We currently have six fuzz targets:
11
12* FuzzParseBinary -- fuzzes the deserialization of the Binary protocol
13* FuzzParseCompact -- fuzzes the deserialization of the Compact protocol
14* FuzzParseJson -- fuzzes the deserialization of the JSON protocol
15* FuzzRoundtripBinary -- fuzzes the roundtrip of the Binary protocol (i.e. serializes then deserializes and compares the result)
16* FuzzRoundtripCompact -- fuzzes the roundtrip of the Compact protocol
17* FuzzRoundtripJson -- fuzzes the roundtrip of the JSON protocol
18
19The fuzzers use libFuzzer's built-in mutation engine to generate test cases. Each fuzzer implements the standard `LLVMFuzzerTestOneInput` interface and uses common testing code from `FuzzCommon.tcc`.
20
21For more information about libFuzzer and its options, see the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html).
22
23You can also use the corpus generator from the Rust implementation to generate initial corpus files that can be used with these C++ fuzzers, since the wire formats are identical between implementations.