aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz
diff options
context:
space:
mode:
authorEdward Barnard2017-03-06 21:07:19 +0000
committerEdward Barnard2017-03-06 21:07:19 +0000
commite322e26b7e8c3dbfcba5c6142ca7559b63fc1652 (patch)
treecd80c7ac9c3e170eadf5fc5ab928a77f06e57219 /fuzz
parent62977a504825f12126aa53c3d5cd8affc95c4a7c (diff)
downloadrust-plist-e322e26b7e8c3dbfcba5c6142ca7559b63fc1652.tar.bz2
Fuzz the binary and xml parsers separately.
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/Cargo.toml13
-rw-r--r--fuzz/fuzzers/binary_reader.rs4
-rw-r--r--fuzz/fuzzers/xml_reader.rs14
3 files changed, 28 insertions, 3 deletions
diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index d1935db..b10e0d5 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -5,13 +5,22 @@ version = "0.0.1"
authors = ["Automatically generated"]
publish = false
+[package.metadata]
+cargo-fuzz = true
+
[dependencies.plist]
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 = "binary_reader"
+path = "fuzzers/binary_reader.rs"
+
+[[bin]]
+name = "xml_reader"
+path = "fuzzers/xml_reader.rs"
diff --git a/fuzz/fuzzers/binary_reader.rs b/fuzz/fuzzers/binary_reader.rs
index 800ca21..4956694 100644
--- a/fuzz/fuzzers/binary_reader.rs
+++ b/fuzz/fuzzers/binary_reader.rs
@@ -4,9 +4,11 @@ extern crate plist;
use std::io::Cursor;
use plist::Plist;
+use plist::binary::EventReader;
#[export_name="rust_fuzzer_test_input"]
pub extern fn go(data: &[u8]) {
let cursor = Cursor::new(data);
- let _ = Plist::read(cursor);
+ let reader = EventReader::new(cursor);
+ let _ = Plist::from_events(reader);
}
diff --git a/fuzz/fuzzers/xml_reader.rs b/fuzz/fuzzers/xml_reader.rs
new file mode 100644
index 0000000..3901b25
--- /dev/null
+++ b/fuzz/fuzzers/xml_reader.rs
@@ -0,0 +1,14 @@
+#![no_main]
+extern crate libfuzzer_sys;
+extern crate plist;
+
+use std::io::Cursor;
+use plist::Plist;
+use plist::xml::EventReader;
+
+#[export_name="rust_fuzzer_test_input"]
+pub extern fn go(data: &[u8]) {
+ let cursor = Cursor::new(data);
+ let reader = EventReader::new(cursor);
+ let _ = Plist::from_events(reader);
+} \ No newline at end of file