/src/gitoxide/gix-revision/fuzz/fuzz_targets/parse.rs
Line | Count | Source |
1 | | #![no_main] |
2 | | use gix_revision::spec::parse::{delegate, Delegate}; |
3 | | use libfuzzer_sys::fuzz_target; |
4 | | |
5 | | use bstr::BStr; |
6 | | |
7 | | fuzz_target!(|data: &[u8]| { |
8 | | drop(gix_revision::spec::parse(data.into(), &mut Noop)); |
9 | | }); |
10 | | |
11 | | struct Noop; |
12 | | |
13 | | impl Delegate for Noop { |
14 | 2.61k | fn done(&mut self) {} |
15 | | } |
16 | | |
17 | | impl delegate::Kind for Noop { |
18 | 955 | fn kind(&mut self, _kind: gix_revision::spec::Kind) -> Option<()> { |
19 | 955 | Some(()) |
20 | 955 | } |
21 | | } |
22 | | |
23 | | impl delegate::Navigate for Noop { |
24 | 6.50k | fn traverse(&mut self, _kind: delegate::Traversal) -> Option<()> { |
25 | 6.50k | Some(()) |
26 | 6.50k | } |
27 | | |
28 | 1.97k | fn peel_until(&mut self, _kind: delegate::PeelTo<'_>) -> Option<()> { |
29 | 1.97k | Some(()) |
30 | 1.97k | } |
31 | | |
32 | 3.44k | fn find(&mut self, _regex: &BStr, _negated: bool) -> Option<()> { |
33 | 3.44k | Some(()) |
34 | 3.44k | } |
35 | | |
36 | 64 | fn index_lookup(&mut self, _path: &BStr, _stage: u8) -> Option<()> { |
37 | 64 | Some(()) |
38 | 64 | } |
39 | | } |
40 | | |
41 | | impl delegate::Revision for Noop { |
42 | 2.71k | fn find_ref(&mut self, _name: &BStr) -> Option<()> { |
43 | 2.71k | Some(()) |
44 | 2.71k | } |
45 | | |
46 | 330 | fn disambiguate_prefix( |
47 | 330 | &mut self, |
48 | 330 | _prefix: gix_hash::Prefix, |
49 | 330 | _hint: Option<delegate::PrefixHint<'_>>, |
50 | 330 | ) -> Option<()> { |
51 | 330 | Some(()) |
52 | 330 | } |
53 | | |
54 | 1.34k | fn reflog(&mut self, _query: delegate::ReflogLookup) -> Option<()> { |
55 | 1.34k | Some(()) |
56 | 1.34k | } |
57 | | |
58 | 85 | fn nth_checked_out_branch(&mut self, _branch_no: usize) -> Option<()> { |
59 | 85 | Some(()) |
60 | 85 | } |
61 | | |
62 | 16 | fn sibling_branch(&mut self, _kind: delegate::SiblingBranch) -> Option<()> { |
63 | 16 | Some(()) |
64 | 16 | } |
65 | | } |