-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexey Arbuzov
committed
Sep 24, 2024
1 parent
afa9d5e
commit 84c6795
Showing
5 changed files
with
54 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
target | ||
corpus | ||
artifacts | ||
coverage |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
|
||
[package] | ||
name = "tlv_parser-fuzz" | ||
version = "0.0.1" | ||
authors = ["Automatically generated"] | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
|
||
[dependencies.tlv_parser] | ||
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" | ||
name = "from_vec" | ||
path = "fuzz_targets/from_vec.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[[bin]] | ||
name = "find-val" | ||
path = "fuzzers/find-val.rs" | ||
name = "find_val" | ||
path = "fuzz_targets/find_val.rs" | ||
test = false | ||
doc = false | ||
bench = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 4 additions & 7 deletions
11
fuzz/fuzzers/fuzzer_script_1.rs → fuzz/fuzz_targets/from_vec.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
#![no_main] | ||
#[macro_use] extern crate libfuzzer_sys; | ||
extern crate tlv_parser; | ||
|
||
use tlv_parser::*; | ||
use libfuzzer_sys::fuzz_target; | ||
use tlv_parser::tlv::Tlv; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
// fuzzed code goes here | ||
match tlv::Tlv::from_vec(data) { | ||
match Tlv::from_vec(data) { | ||
Ok(tlv) => { | ||
let restored_tlv = tlv.to_vec(); | ||
assert!(!restored_tlv.is_empty()); | ||
}, | ||
} | ||
Err(_) => (), | ||
} | ||
}); | ||
|