From 736edae2ad243f6eb3e7b01ca9b6266745cdeb24 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 11 Jan 2026 23:01:30 -1030 Subject: add fuzzer for azalea-protocol and fix a few panics --- azalea-protocol/fuzz/fuzz_targets/clientbound_config.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/clientbound_game.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/clientbound_handshake.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/clientbound_login.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/clientbound_status.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/serverbound_config.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/serverbound_game.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/serverbound_handshake.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/serverbound_login.rs | 10 ++++++++++ azalea-protocol/fuzz/fuzz_targets/serverbound_status.rs | 10 ++++++++++ 10 files changed, 100 insertions(+) create mode 100644 azalea-protocol/fuzz/fuzz_targets/clientbound_config.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/clientbound_game.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/clientbound_handshake.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/clientbound_login.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/clientbound_status.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/serverbound_config.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/serverbound_game.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/serverbound_handshake.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/serverbound_login.rs create mode 100644 azalea-protocol/fuzz/fuzz_targets/serverbound_status.rs (limited to 'azalea-protocol/fuzz/fuzz_targets') diff --git a/azalea-protocol/fuzz/fuzz_targets/clientbound_config.rs b/azalea-protocol/fuzz/fuzz_targets/clientbound_config.rs new file mode 100644 index 00000000..79ffd95b --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/clientbound_config.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::config::ClientboundConfigPacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/clientbound_game.rs b/azalea-protocol/fuzz/fuzz_targets/clientbound_game.rs new file mode 100644 index 00000000..a253a859 --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/clientbound_game.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::game::ClientboundGamePacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/clientbound_handshake.rs b/azalea-protocol/fuzz/fuzz_targets/clientbound_handshake.rs new file mode 100644 index 00000000..84061965 --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/clientbound_handshake.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::handshake::ClientboundHandshakePacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/clientbound_login.rs b/azalea-protocol/fuzz/fuzz_targets/clientbound_login.rs new file mode 100644 index 00000000..6339fcea --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/clientbound_login.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::login::ClientboundLoginPacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/clientbound_status.rs b/azalea-protocol/fuzz/fuzz_targets/clientbound_status.rs new file mode 100644 index 00000000..38264f64 --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/clientbound_status.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::status::ClientboundStatusPacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/serverbound_config.rs b/azalea-protocol/fuzz/fuzz_targets/serverbound_config.rs new file mode 100644 index 00000000..d2a13d1d --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/serverbound_config.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::config::ServerboundConfigPacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/serverbound_game.rs b/azalea-protocol/fuzz/fuzz_targets/serverbound_game.rs new file mode 100644 index 00000000..8891485c --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/serverbound_game.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::game::ServerboundGamePacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/serverbound_handshake.rs b/azalea-protocol/fuzz/fuzz_targets/serverbound_handshake.rs new file mode 100644 index 00000000..be3fca35 --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/serverbound_handshake.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::handshake::ServerboundHandshakePacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/serverbound_login.rs b/azalea-protocol/fuzz/fuzz_targets/serverbound_login.rs new file mode 100644 index 00000000..e0e4a384 --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/serverbound_login.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::login::ServerboundLoginPacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); diff --git a/azalea-protocol/fuzz/fuzz_targets/serverbound_status.rs b/azalea-protocol/fuzz/fuzz_targets/serverbound_status.rs new file mode 100644 index 00000000..65429b29 --- /dev/null +++ b/azalea-protocol/fuzz/fuzz_targets/serverbound_status.rs @@ -0,0 +1,10 @@ +#![no_main] + +use std::io::Cursor; + +use azalea_protocol::{packets::status::ServerboundStatusPacket, read::deserialize_packet}; +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let _ = deserialize_packet::(&mut Cursor::new(data)); +}); -- cgit v1.2.3