commit
4ee884a1e8
@ -0,0 +1,30 @@ |
||||
|
||||
[package] |
||||
name = "tungstenite-fuzz" |
||||
version = "0.0.1" |
||||
authors = ["Sergey \"Shnatsel\" Davidoff <shnatsel@gmail.com>"] |
||||
publish = false |
||||
|
||||
[package.metadata] |
||||
cargo-fuzz = true |
||||
|
||||
[dependencies.tungstenite] |
||||
path = ".." |
||||
[dependencies.libfuzzer-sys] |
||||
git = "https://github.com/rust-fuzz/libfuzzer-sys.git" |
||||
|
||||
# Prevent this from interfering with workspaces |
||||
[workspace] |
||||
members = ["."] |
||||
|
||||
[[bin]] |
||||
name = "parse_frame" |
||||
path = "fuzz_targets/parse_frame.rs" |
||||
|
||||
[[bin]] |
||||
name = "read_message_server" |
||||
path = "fuzz_targets/read_message_server.rs" |
||||
|
||||
[[bin]] |
||||
name = "read_message_client" |
||||
path = "fuzz_targets/read_message_client.rs" |
@ -0,0 +1,12 @@ |
||||
#![no_main] |
||||
#[macro_use] extern crate libfuzzer_sys; |
||||
extern crate tungstenite; |
||||
|
||||
use std::io::Cursor; |
||||
|
||||
fuzz_target!(|data: &[u8]| { |
||||
let vector: Vec<u8> = data.into(); |
||||
let mut cursor = Cursor::new(vector); |
||||
|
||||
tungstenite::protocol::frame::Frame::parse(&mut cursor); |
||||
}); |
@ -0,0 +1,37 @@ |
||||
#![no_main] |
||||
#[macro_use] extern crate libfuzzer_sys; |
||||
extern crate tungstenite; |
||||
|
||||
use std::io; |
||||
use std::io::Cursor; |
||||
use tungstenite::WebSocket; |
||||
use tungstenite::protocol::Role; |
||||
//use std::result::Result;
|
||||
|
||||
// FIXME: copypasted from tungstenite's protocol/mod.rs
|
||||
|
||||
struct WriteMoc<Stream>(Stream); |
||||
|
||||
impl<Stream> io::Write for WriteMoc<Stream> { |
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { |
||||
Ok(buf.len()) |
||||
} |
||||
fn flush(&mut self) -> io::Result<()> { |
||||
Ok(()) |
||||
} |
||||
} |
||||
|
||||
impl<Stream: io::Read> io::Read for WriteMoc<Stream> { |
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { |
||||
self.0.read(buf) |
||||
} |
||||
} |
||||
|
||||
// end of copypasta
|
||||
|
||||
fuzz_target!(|data: &[u8]| { |
||||
//let vector: Vec<u8> = data.into();
|
||||
let cursor = Cursor::new(data); |
||||
let mut socket = WebSocket::from_raw_socket(WriteMoc(cursor), Role::Client, None); |
||||
socket.read_message(); |
||||
}); |
@ -0,0 +1,37 @@ |
||||
#![no_main] |
||||
#[macro_use] extern crate libfuzzer_sys; |
||||
extern crate tungstenite; |
||||
|
||||
use std::io; |
||||
use std::io::Cursor; |
||||
use tungstenite::WebSocket; |
||||
use tungstenite::protocol::Role; |
||||
//use std::result::Result;
|
||||
|
||||
// FIXME: copypasted from tungstenite's protocol/mod.rs
|
||||
|
||||
struct WriteMoc<Stream>(Stream); |
||||
|
||||
impl<Stream> io::Write for WriteMoc<Stream> { |
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { |
||||
Ok(buf.len()) |
||||
} |
||||
fn flush(&mut self) -> io::Result<()> { |
||||
Ok(()) |
||||
} |
||||
} |
||||
|
||||
impl<Stream: io::Read> io::Read for WriteMoc<Stream> { |
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { |
||||
self.0.read(buf) |
||||
} |
||||
} |
||||
|
||||
// end of copypasta
|
||||
|
||||
fuzz_target!(|data: &[u8]| { |
||||
//let vector: Vec<u8> = data.into();
|
||||
let cursor = Cursor::new(data); |
||||
let mut socket = WebSocket::from_raw_socket(WriteMoc(cursor), Role::Server, None); |
||||
socket.read_message(); |
||||
}); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue