feat(fuzz): add rcon & query fuzzing
This commit is contained in:
1 parent
8060283970
commit
44270fbde1
7 files changed
+3003
-49
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use pumpkin_protocol::query::{RawQueryPacket, SHandshake, SStatusRequest};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let rt = Runtime::new().unwrap();
|
||||
|
||||
rt.block_on(async {
|
||||
if let Ok(mut raw) = RawQueryPacket::decode(data.to_vec()).await {
|
||||
match raw.packet_type {
|
||||
pumpkin_protocol::query::PacketType::Handshake => {
|
||||
let _ = SHandshake::decode(&mut raw).await;
|
||||
}
|
||||
pumpkin_protocol::query::PacketType::Status => {
|
||||
let _ = SStatusRequest::decode(&mut raw).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
#![no_main]
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use pumpkin::net::rcon::packet::Packet;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let mut incoming = data.to_vec();
|
||||
let _ = Packet::deserialize(&mut incoming);
|
||||
});
|
||||
Reference in new issue
Block a user