Add afl harness program

parent e3fdb1c1
Pipeline #5648994 passed with stage
in 4 minutes 45 seconds
# Compiled files
*.o
*.so
*.rlib
*.dll
*.pyc
# Executables
*.exe
# Generated by Cargo
/target/
Cargo.lock
# Copyright (c) 2017 The Robigalia Project Developers
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT
# or http://opensource.org/licenses/MIT>, at your option. All files in the
# project carrying such notice may not be copied, modified, or distributed
# except according to those terms.
[package]
name = "ssmarshal_fuzz"
version = "0.0.1"
authors = ["Corey Richardson <corey@octayn.net>"]
license = "MIT OR Apache-2.0"
[dependencies]
serde = "*"
serde_derive = "*"
ssmarshal = { path = ".." }
afl = "*"
afl-plugin = "*"
[profile.release]
debug = true
// Copyright (c) 2017 The Robigalia Project Developers Licensed under the Apache License, Version
// 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. All files in the project
// carrying such notice may not be copied, modified, or distributed except according to those
// terms.
#![feature(plugin, proc_macro, test)]
#![plugin(afl_plugin)]
extern crate afl;
extern crate ssmarshal;
extern crate test;
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize, Debug)]
struct Simple {
a: u8,
b: (u16, u8),
c: char,
d: [usize; 3],
}
#[derive(Deserialize, Debug)]
enum Complex {
A,
B(Simple),
C(u8, u16),
D(isize),
E {
foo: Simple
},
F {
bar: Simple,
baz: Simple,
qux: char
}
}
fn main() {
afl::handle_bytes(|v| {
match ssmarshal::deserialize::<Complex>(&v) {
Ok((val, bytes)) => {
test::black_box(val);
},
Err(e) => {
}
}
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment