wayver's git archive


a simple self-hosted git server
git clone https://git.wayver.dev/bile

fuzz/src/main.rs@bd1a8f79badd439ab7a73e193be91ad175aafa67

raw
Date Commit Message Author Files + -
2026-02-17 21:07 initial mvp wayverd 74 10800 0
...

1use axum::{
2    body::Body,
3    http::{Request, StatusCode},
4};
5use http_body_util::BodyExt as _;
6use tower::util::ServiceExt as _;
7
8fn main() {
9    bile::set_config(bile::config::Config::default().finalize().unwrap());
10
11    afl::fuzz!(|data: &[u8]| {
12        if let Ok(s) = std::str::from_utf8(data) {
13            if let Ok(uri) = http::Uri::try_from(s) {
14                let Ok(rt) = tokio::runtime::Runtime::new() else {
15                    println!("failed to create tokio runtime");
16                    return;
17                };
18
19                rt.block_on(async {
20                    let Ok(req) = Request::builder().uri(uri).body(Body::empty()) else {
21                        println!("failed to create http request");
22                        return;
23                    };
24
25                    let Ok(res) = bile::routes().oneshot(req).await else {
26                        println!("failed to send http request");
27                        return;
28                    };
29
30                    assert_ne!(res.status(), StatusCode::INTERNAL_SERVER_ERROR);
31                });
32            }
33        }
34    });
35}
36