Initial impl
This commit is contained in:
commit
4b729c5d32
133 files changed
+20475
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# Fuzzing the .http parser (needs nightly):
|
||||
# cargo install cargo-fuzz
|
||||
# cargo +nightly fuzz run parse
|
||||
[package]
|
||||
name = "reqlite-fuzz"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
libfuzzer-sys = "0.4"
|
||||
reqlite-core = { path = "../crates/core" }
|
||||
|
||||
[[bin]]
|
||||
name = "parse"
|
||||
path = "fuzz_targets/parse.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
||||
|
||||
[workspace]
|
||||
@@ -0,0 +1,16 @@
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use reqlite_core::httpfile::HttpFile;
|
||||
|
||||
fuzz_target!(|data: &str| {
|
||||
let f = HttpFile::parse(data);
|
||||
assert_eq!(f.write(), data);
|
||||
for i in 0..f.request_count() {
|
||||
let r = f.request(i).unwrap().clone();
|
||||
assert_eq!(f.replace_request(i, &r).unwrap(), data);
|
||||
let src = f.request_source(i).unwrap().to_string();
|
||||
let again = HttpFile::parse(f.replace_request_text(i, &src).unwrap());
|
||||
assert_eq!(again.request_count(), f.request_count());
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user