Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fuzz testing with
Read
trait and fix OOM on incorrect input
- Loading branch information
1 parent
fef1106
commit 66a22c8
Showing
6 changed files
with
70 additions
and
9 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![no_main] | ||
#[macro_use] extern crate libfuzzer_sys; | ||
extern crate protobuf_fuzz; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
protobuf_fuzz::fuzz_target_empty_message_read(data) | ||
}); |
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,7 +1,14 @@ | ||
extern crate protobuf; | ||
|
||
use std::io::BufReader; | ||
|
||
pub mod all_types_pb; | ||
|
||
pub fn fuzz_target_empty_message(bytes: &[u8]) { | ||
drop(protobuf::parse_from_bytes::<all_types_pb::EmptyMessage>(bytes)); | ||
} | ||
|
||
pub fn fuzz_target_empty_message_read(bytes: &[u8]) { | ||
let mut reader = BufReader::new(bytes); | ||
drop(protobuf::parse_from_reader::<all_types_pb::EmptyMessage>(&mut reader)); | ||
} |
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
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
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