Skip to content

Commit

Permalink
Intial addition of libfuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
stusmall committed Apr 30, 2019
1 parent 64dbb97 commit 90beec4
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target
corpus
artifacts
22 changes: 22 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

[package]
name = "snow-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false

[package.metadata]
cargo-fuzz = true

[dependencies.snow]
path = ".."
[dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"

# Prevent this from interfering with workspaces
[workspace]
members = ["."]

[[bin]]
name = "params"
path = "fuzz_targets/params.rs"
12 changes: 12 additions & 0 deletions fuzz/fuzz_targets/params.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate snow;

use snow::Error;
use snow::params::NoiseParams;

fuzz_target!(|data: &[u8]| {
if let Ok(s) = String::from_utf8(data.to_vec()){
let _: Result<NoiseParams,Error> = s.parse();
}
});
9 changes: 9 additions & 0 deletions tests/fuzz_findings.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extern crate snow;

use snow::Error;
use snow::params::NoiseParams;

#[test]
fn fuzz_1(){
let _: Result<NoiseParams,Error> = "Noise_/I××QQQ••".parse();
}

0 comments on commit 90beec4

Please sign in to comment.