mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-12-13 01:50:41 +01:00
Merge pull request #58 from 5225225/fuzzy
Add fuzzing harness, in order to find panics through invalid input
This commit is contained in:
commit
a7ad38b6fa
4
kalk/fuzz/.gitignore
vendored
Normal file
4
kalk/fuzz/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
target
|
||||
corpus
|
||||
artifacts
|
26
kalk/fuzz/Cargo.toml
Normal file
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
|
10
kalk/fuzz/fuzz_targets/parse.rs
Normal file
10
kalk/fuzz/fuzz_targets/parse.rs
Normal file
@ -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);
|
||||
});
|
Loading…
Reference in New Issue
Block a user