1
0
mirror of https://github.com/PaddiM8/kalker.git synced 2025-07-06 17:30:07 +02:00

Merge pull request from 5225225/fuzzy

Add fuzzing harness, in order to find panics through invalid input
This commit is contained in:
PaddiM8
2021-09-22 14:42:00 +02:00
committed by GitHub
3 changed files with 40 additions and 0 deletions
kalk/fuzz

4
kalk/fuzz/.gitignore vendored Normal file

@ -0,0 +1,4 @@
target
corpus
artifacts

26
kalk/fuzz/Cargo.toml Normal file

@ -0,0 +1,26 @@
[package]
name = "kalk-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.4"
[dependencies.kalk]
path = ".."
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "parse"
path = "fuzz_targets/parse.rs"
test = false
doc = false

@ -0,0 +1,10 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
fuzz_target!(|data: &str| {
let mut ctx = kalk::parser::Context::new().set_timeout(Some(5));
// We don't care if it parses or not, we only care about if it panicked
// while parsing
let _ = kalk::parser::parse(&mut ctx, data);
});