Coverage Report

Created: 2026-06-30 06:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gitoxide/gix-credentials/fuzz/fuzz_targets/context.rs
Line
Count
Source
1
#![no_main]
2
3
use gix_credentials::protocol::Context;
4
use libfuzzer_sys::fuzz_target;
5
use std::hint::black_box;
6
7
7.89k
fn fuzz(input: &[u8]) {
8
7.89k
    if let Ok(ctx) = Context::from_bytes(input) {
9
6.82k
        inspect_context(ctx.clone());
10
6.82k
11
6.82k
        let mut with_http = ctx.clone();
12
6.82k
        _ = black_box(with_http.destructure_url_in_place(true));
13
6.82k
        _ = black_box(with_http);
14
6.82k
15
6.82k
        let mut without_http = ctx;
16
6.82k
        _ = black_box(without_http.destructure_url_in_place(false));
17
6.82k
        _ = black_box(without_http);
18
6.82k
    }
19
7.89k
}
20
21
6.82k
fn inspect_context(mut ctx: Context) {
22
6.82k
    let mut out = Vec::new();
23
6.82k
    _ = black_box(ctx.write_to(&mut out));
24
6.82k
    _ = black_box(ctx.to_bstring());
25
6.82k
    _ = black_box(ctx.to_url());
26
6.82k
    _ = black_box(ctx.to_prompt("Username"));
27
6.82k
    _ = black_box(ctx.clone().redacted());
28
6.82k
    ctx.clear_secrets();
29
6.82k
    _ = black_box(ctx);
30
6.82k
    if let Ok(roundtrip) = Context::from_bytes(&out) {
31
6.82k
        _ = black_box(roundtrip);
32
6.82k
    }
33
6.82k
}
34
35
fuzz_target!(|input: &[u8]| {
36
    fuzz(input);
37
});