From 1513f840111dd1662b4a68ccd65fde5d8ebc189d Mon Sep 17 00:00:00 2001 From: can olgun Date: Sat, 13 Jun 2026 23:29:26 +0300 Subject: [PATCH] Add cargo-fuzz target: URI parsing for OSS-Fuzz --- fuzz/Cargo.toml | 19 +++++++++++++++++++ fuzz/fuzz_targets/fuzz_uri.rs | 9 +++++++++ 2 files changed, 28 insertions(+) create mode 100644 fuzz/Cargo.toml create mode 100644 fuzz/fuzz_targets/fuzz_uri.rs diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 0000000000..29fb21cf5d --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "rocket-fuzz" +version = "0.0.0" +edition = "2021" +publish = false + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" +http = "1" +bytes = "1" + +[[bin]] +name = "fuzz_uri" +path = "fuzz_targets/fuzz_uri.rs" +test = false +doc = false diff --git a/fuzz/fuzz_targets/fuzz_uri.rs b/fuzz/fuzz_targets/fuzz_uri.rs new file mode 100644 index 0000000000..9fc8edc9ef --- /dev/null +++ b/fuzz/fuzz_targets/fuzz_uri.rs @@ -0,0 +1,9 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +use bytes::Bytes; +use http::Uri; + +fuzz_target!(|data: &[u8]| { + // Rocket URI/route parsing — pre-auth + let _ = Uri::from_maybe_shared(Bytes::copy_from_slice(data)); +});