10
0
Fork 0
mirror of https://github.com/ZeusWPI/ZNS.git synced 2024-11-23 22:11:10 +01:00

add fuzzer

This commit is contained in:
Xander Bil 2024-10-29 22:18:41 +01:00
parent 341f79f5ad
commit 9c3d152618
No known key found for this signature in database
GPG key ID: EC9706B54A278598
3 changed files with 21 additions and 1 deletions

View file

@ -17,3 +17,10 @@ path = "fuzz_targets/parser.rs"
test = false
doc = false
bench = false
[[bin]]
name = "parser_to_bytes"
path = "fuzz_targets/parser_to_bytes.rs"
test = false
doc = false
bench = false

View file

@ -1,9 +1,14 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use zns::{parser::FromBytes, reader::Reader, structs::Message};
use zns::{
parser::{FromBytes},
reader::Reader,
structs::Message,
};
fuzz_target!(|data: &[u8]| {
let mut reader = Reader::new(data);
let _ = Message::from_bytes(&mut reader);
});

View file

@ -0,0 +1,8 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use zns::{parser::ToBytes, structs::Message};
fuzz_target!(|message: Message| {
let _ = Message::to_bytes(message);
});