mirror of
https://github.com/bspeice/dtparse
synced 2025-07-02 22:34:57 -04:00
Add fuzzing, find and fix a parser bug.
This commit is contained in:
5
fuzz/.gitignore
vendored
Normal file
5
fuzz/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
target
|
||||
libfuzzer
|
||||
corpus
|
||||
artifacts
|
22
fuzz/Cargo.toml
Normal file
22
fuzz/Cargo.toml
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
[package]
|
||||
name = "dtparse-fuzz"
|
||||
version = "0.0.1"
|
||||
authors = ["Automatically generated"]
|
||||
publish = false
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies.dtparse]
|
||||
path = ".."
|
||||
[dependencies.libfuzzer-sys]
|
||||
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
|
||||
|
||||
# Prevent this from interfering with workspaces
|
||||
[workspace]
|
||||
members = ["."]
|
||||
|
||||
[[bin]]
|
||||
name = "fuzzer_script_1"
|
||||
path = "fuzzers/fuzzer_script_1.rs"
|
10
fuzz/fuzzers/fuzzer_script_1.rs
Normal file
10
fuzz/fuzzers/fuzzer_script_1.rs
Normal file
@ -0,0 +1,10 @@
|
||||
#![no_main]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate dtparse;
|
||||
use dtparse::parse;
|
||||
#[export_name="rust_fuzzer_test_input"]
|
||||
pub extern fn go(data: &[u8]) {
|
||||
if let Ok(s) = sd::str::from_utf8(data) {
|
||||
parse(s);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user