mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 14:48:08 -05:00
Create a fuzz harness to test the ./zkas binary compilation process. The whole pipeline is tested: Lexer, Parser, Compiler, Analyzer. This is performed by copying the relevant code from bin/zkas/src/main.rs. Testing the entire pipeline like this is not very efficient in terms of fuzzing cycles but on the other hand it is a quick-and-dirty way to find results. It also benefits from testing the actual inputs to the binary in the way it's expecting, rather than checking each of the components in a piecemeal way using interfaces that aren't expected to be exposed anyway.
Fuzz2 - honggfuzz
This directory contains files pertaining to fuzz testing with the honggfuzz fuzzer.
We're trying this tool out alongside libfuzzer (covered in darkfi/fuzz/).
Comparison to libfuzzer
- Does not halt execution on crashes (can discover multiple crashes in one fuzzing session)
- Fewer memory issues (tool less likely to crash, easier to configure)
- Better UI
Install
cargo install honggfuzz
Usage
# Build targets from Cargo.toml [[bin]] section
cargo hfuzz build
# Run
cargo hfuzz run zkbinary-decode
Further info: https://docs.rs/honggfuzz/latest/honggfuzz/#how-to-use-this-crate