Skip to content

Commit

Permalink
cargo-fuzz: add new target to parse responses
Browse files Browse the repository at this point in the history
Add a new cargo-fuzz target to test the Response parsing code.
  • Loading branch information
00xc committed May 24, 2023
1 parent 46c9c9b commit 7827885
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ name = "parse_headers"
path = "fuzz_targets/parse_headers.rs"
test = false
doc = false

[[bin]]
name = "parse_response"
path = "fuzz_targets/parse_response.rs"
test = false
doc = false
8 changes: 8 additions & 0 deletions fuzz/fuzz_targets/parse_response.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#![no_main]
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
let mut headers = [httparse::EMPTY_HEADER; 16];
let mut resp = httparse::Response::new(&mut headers);
let _ = resp.parse(data);
});

0 comments on commit 7827885

Please sign in to comment.