Merge pull request #44 from Shnatsel/master

Add fuzzing harness and seeds
pull/48/head
Alexey Galakhov 7 years ago committed by GitHub
commit 4ee884a1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      fuzz/Cargo.toml
  2. 12
      fuzz/fuzz_targets/parse_frame.rs
  3. 37
      fuzz/fuzz_targets/read_message_client.rs
  4. 37
      fuzz/fuzz_targets/read_message_server.rs
  5. BIN
      fuzz/seeds/parse_frame/0a476920bf2b922f5d1955e5bedfedec8c13765c
  6. 1
      fuzz/seeds/parse_frame/0b3a842c0b93a42d724bbab2504ae92f0593232a
  7. 1
      fuzz/seeds/parse_frame/0e1990ce3bb9b7c62d5e11b83514467eca3be187
  8. 1
      fuzz/seeds/parse_frame/0fe89d4911d87df66f98147a0fd1f3624f34cdaa
  9. BIN
      fuzz/seeds/parse_frame/370ee4d5682fb8c2770cac1ec89e0f6674990afb
  10. BIN
      fuzz/seeds/parse_frame/47167be8eb1f00d36f0a93a8f61c77b4d4d2f515
  11. 1
      fuzz/seeds/parse_frame/51112bf88688ede230dd473db8fa0be2b945e636
  12. 1
      fuzz/seeds/parse_frame/7a0edc789a1d22737bfbb4cb29f26d994614cb80
  13. 1
      fuzz/seeds/parse_frame/9cf76db0663ea4025bbf89de1dfbb2ff818a26ae
  14. BIN
      fuzz/seeds/parse_frame/bc4057a2970c60f0c2b07200842b8d0c15e2af27
  15. 1
      fuzz/seeds/parse_frame/bd811f21956aa72bb5a9114bdf4dc61e1710ad44
  16. BIN
      fuzz/seeds/parse_frame/dc048e38bdb36cf80cc4fe5b3b21ea094510af4a
  17. 1
      fuzz/seeds/parse_frame/ec7d070174e40ace678006d0c631026f1d9a0779
  18. BIN
      fuzz/seeds/parse_frame/ef420abfddbda7b9ee665d85ef62e4a437554003
  19. BIN
      fuzz/seeds/parse_frame/fab3e168d56fecfc59f98a69f75673a53e94c215
  20. 1
      fuzz/seeds/read_message_client/00eab9387f47a4a5730f86495676590ed99648ad
  21. BIN
      fuzz/seeds/read_message_client/01e7f49a07a58b982e6f7e88139c08111c683c95
  22. BIN
      fuzz/seeds/read_message_client/021f5383e71825e2e10a231f82e6d30a250d4372
  23. BIN
      fuzz/seeds/read_message_client/03c696ca65bfd5e3d29d317db3cb6d959a99a6f1
  24. BIN
      fuzz/seeds/read_message_client/03c7e6ffc3fd995f756bb9fa4e5695ebf508c382
  25. BIN
      fuzz/seeds/read_message_client/044ea4857360e1e3bd1f725c595134c04ec18d54
  26. 1
      fuzz/seeds/read_message_client/0498cb7cb6ed1243ca48bc23134d69eabb08f9ac
  27. BIN
      fuzz/seeds/read_message_client/04aaf13929e1759332873f8140baf79e690060f3
  28. BIN
      fuzz/seeds/read_message_client/05310f0cea541a28ac3da35fddb07908063d03bd
  29. 1
      fuzz/seeds/read_message_client/0536c7abab6c1dca55cda6c0a3b4d0a59ddf7bef
  30. BIN
      fuzz/seeds/read_message_client/053d8d6ceeba9453c97d0ee5374db863e6f77ad4
  31. BIN
      fuzz/seeds/read_message_client/057e5e9b810e67c9cc993b95dd1a708e2e18ae01
  32. BIN
      fuzz/seeds/read_message_client/05c66e493fcb8826b4e4ccaa67c40777965355fb
  33. BIN
      fuzz/seeds/read_message_client/05df11a2345b57abe169893729b9f379b27a0867
  34. BIN
      fuzz/seeds/read_message_client/06839aaa3e0b5bab80ef646e0150e876afe8e1f0
  35. BIN
      fuzz/seeds/read_message_client/06a13f550308ad319da4dfc8ca037a1b1f3d0b79
  36. BIN
      fuzz/seeds/read_message_client/06cdb86a0cc62b7dff6cd26b36ecf68f5ac75464
  37. BIN
      fuzz/seeds/read_message_client/06d480a0b97e0c1829d8e9ac9e352c9605b4735a
  38. BIN
      fuzz/seeds/read_message_client/06df8c818cc5e6814e7489746091a5c21eff6d75
  39. 1
      fuzz/seeds/read_message_client/072bbbc39681c0e141cb9d3d739e3dd0655370c0
  40. BIN
      fuzz/seeds/read_message_client/075cd646b912d276fde95c9f7ece9e25307b50ce
  41. BIN
      fuzz/seeds/read_message_client/0761da395d2f1d2d1ee791c6073e46edb1e42518
  42. BIN
      fuzz/seeds/read_message_client/08ba58e6809f60afdf92b90b322d9c5a80742c4b
  43. BIN
      fuzz/seeds/read_message_client/09234b91f9c6845e8d2b8035b04dfc994c223c4f
  44. 1
      fuzz/seeds/read_message_client/0941558f2b2cae40388e0b813da0c2987988a3e3
  45. BIN
      fuzz/seeds/read_message_client/095445df7d6bf21c0dce759980f8715230853392
  46. BIN
      fuzz/seeds/read_message_client/09c3222db2ca0cbe4d891585d6f0d59e6a5dda86
  47. BIN
      fuzz/seeds/read_message_client/0a41c5fdeda7263b8d543c274b757f3d5866eb8f
  48. BIN
      fuzz/seeds/read_message_client/0a6c69648849afe7731fda694bdcdcc57dfa42a9
  49. BIN
      fuzz/seeds/read_message_client/0a8e305e4ff8c1f218b9ada97de758ffbc3f3d40
  50. BIN
      fuzz/seeds/read_message_client/0aaf76f425c6e0f43a36197de768e67d9e035abb
  51. BIN
      fuzz/seeds/read_message_client/0bca4fb3ea4a8d39468d01310a757621e94b461a
  52. BIN
      fuzz/seeds/read_message_client/0c325ddbd04085956a5f9721107ab95f6287ab22
  53. BIN
      fuzz/seeds/read_message_client/0c381170e86893ccf51e5c17c16bccab4440c7e0
  54. BIN
      fuzz/seeds/read_message_client/0c5a11be4ebe9d461df3feb44a58b33425fcfda0
  55. BIN
      fuzz/seeds/read_message_client/0ca5899662e56778661d6c857348dd0ac5336fb8
  56. BIN
      fuzz/seeds/read_message_client/0ce2b6ae812a98ce2161bc991a238cfdc8989c79
  57. BIN
      fuzz/seeds/read_message_client/0cecc7b469171f5001923013229fa8c08318f504
  58. BIN
      fuzz/seeds/read_message_client/0d4dd85a5527c813ce78bd3a48a9c8911ad61dee
  59. BIN
      fuzz/seeds/read_message_client/0da5377028976cfaceaf941cbb249296b36e63c6
  60. 1
      fuzz/seeds/read_message_client/0e1990ce3bb9b7c62d5e11b83514467eca3be187
  61. BIN
      fuzz/seeds/read_message_client/0e356ba505631fbf715758bed27d503f8b260e3a
  62. BIN
      fuzz/seeds/read_message_client/0e60dc9b7325d5b0b8192e207d00f1ea3399fb56
  63. 1
      fuzz/seeds/read_message_client/0fa68637010fb6f345609f4b329ee3597f8d4d01
  64. BIN
      fuzz/seeds/read_message_client/10628b32dc8687c33f9b7de052280dd712b9475d
  65. BIN
      fuzz/seeds/read_message_client/11b86700d2260a1021d6df54ef49dc1a7bd8b768
  66. BIN
      fuzz/seeds/read_message_client/12121410f1b7225c00ba39770da72aaf4c008647
  67. 1
      fuzz/seeds/read_message_client/1238b8d4729c0d1bf2a76efeff3cb2183d64a076
  68. BIN
      fuzz/seeds/read_message_client/12715cc3a089f0fcb1aa4825d5567854b8d2e857
  69. 1
      fuzz/seeds/read_message_client/12a340d7897fe713fc8f02ac5365b86ebf353178
  70. BIN
      fuzz/seeds/read_message_client/136355818cfdc1f48f2388b5b6fc0a0c0522fd97
  71. BIN
      fuzz/seeds/read_message_client/143135fb28a8483027b0f3ca4477d93c906572e9
  72. BIN
      fuzz/seeds/read_message_client/1489f923c4dca729178b3e3233458550d8dddf29
  73. BIN
      fuzz/seeds/read_message_client/14b63eec10c76962198826cd07e8dc216359725d
  74. BIN
      fuzz/seeds/read_message_client/1501c2877adbe1ab08821c6e4fb0e55e9eb70053
  75. BIN
      fuzz/seeds/read_message_client/1572a4cdd0732529d3320715a2f1a8349f285682
  76. BIN
      fuzz/seeds/read_message_client/15adf6cc93949d9249088a313db23137a5c26e4d
  77. BIN
      fuzz/seeds/read_message_client/15d14e97fb9ff7c753ced954b211d08f9b82d47f
  78. BIN
      fuzz/seeds/read_message_client/15f7ebf5f31acb7910ad825f698c560244e07032
  79. BIN
      fuzz/seeds/read_message_client/163a980e3b5b687651f53abc16367d18d629774d
  80. 1
      fuzz/seeds/read_message_client/16473cd9f3bd4fbafc953f5be2ce09a0efd340af
  81. BIN
      fuzz/seeds/read_message_client/1673f92a5b720f223fae4ec53f8dd8a53c38572c
  82. BIN
      fuzz/seeds/read_message_client/1700f687f2b17bfd0c6d40bbf43829caafb685eb
  83. BIN
      fuzz/seeds/read_message_client/1786d8ff398f56e2205ab897a7d732e570587f67
  84. 1
      fuzz/seeds/read_message_client/1794eed6226d2284c3625f4e8eceec71c9eaaeb9
  85. 1
      fuzz/seeds/read_message_client/189cc800bd0d32f454bd5ec77fe18d0778895203
  86. BIN
      fuzz/seeds/read_message_client/193a07eba051b8b0bbf27137703aad64a76b8691
  87. BIN
      fuzz/seeds/read_message_client/1944641c9574ef6137123c0248dfd50c0ae94afa
  88. BIN
      fuzz/seeds/read_message_client/1947566eaaaf6c36e16cb5db580f628431f5f02f
  89. BIN
      fuzz/seeds/read_message_client/19e19619104a7247c7928b92625b78f36fc99cfd
  90. BIN
      fuzz/seeds/read_message_client/1add1c6a85dd2c8f7b18b91ae3033979ccdc51af
  91. BIN
      fuzz/seeds/read_message_client/1b35eb37b72c3eafa85a44ee6d5c01d6d79f54e9
  92. BIN
      fuzz/seeds/read_message_client/1ba68ef2c6f34420838c45f4b76b0d06e91f83b3
  93. BIN
      fuzz/seeds/read_message_client/1bfbad96579be9202bb886ac132b1e2bcee73aaa
  94. BIN
      fuzz/seeds/read_message_client/1d91f7013b96ea476245b30dd10d528e0be7463f
  95. BIN
      fuzz/seeds/read_message_client/1e03f88ec404eca82424415c8136ce75bcf0cf37
  96. BIN
      fuzz/seeds/read_message_client/1ee910ec73a59d176f09b8426ea42265385ee1e9
  97. BIN
      fuzz/seeds/read_message_client/1f6872798bd33a1c53fb99ddc4a90c7b962c613f
  98. BIN
      fuzz/seeds/read_message_client/1fdc5702122c81aeecda8b4522234e9ef65ba317
  99. BIN
      fuzz/seeds/read_message_client/204b6e07c990e8ecef2c2e289fe900103de46629
  100. 1
      fuzz/seeds/read_message_client/2058be72006b00ce316ab6ec3a0461f6d416e340
  101. Some files were not shown because too many files have changed in this diff Show More

@ -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();
});

@ -0,0 +1 @@
<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD>0

@ -0,0 +1 @@
<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD>s<EFBFBD><EFBFBD>A<EFBFBD><EFBFBD>(

@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>+<EFBFBD><EFBFBD>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save