File tree Expand file tree Collapse file tree 5 files changed +67
-0
lines changed Expand file tree Collapse file tree 5 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -67,3 +67,21 @@ name = "fuzz_sparse_bit_set_encode"
67
67
path = " fuzz_targets/fuzz_sparse_bit_set_encode.rs"
68
68
test = false
69
69
doc = false
70
+
71
+ [[bin ]]
72
+ name = " fuzz_gdef"
73
+ path = " fuzz_targets/fuzz_gdef.rs"
74
+ test = false
75
+ doc = false
76
+
77
+ [[bin ]]
78
+ name = " fuzz_gpos"
79
+ path = " fuzz_targets/fuzz_gpos.rs"
80
+ test = false
81
+ doc = false
82
+
83
+ [[bin ]]
84
+ name = " fuzz_gsub"
85
+ path = " fuzz_targets/fuzz_gsub.rs"
86
+ test = false
87
+ doc = false
Original file line number Diff line number Diff line change
1
+ #![ no_main]
2
+
3
+ mod traversal_fuzz;
4
+ use libfuzzer_sys:: { fuzz_target, Corpus } ;
5
+ use read_fonts:: tables:: gdef:: Gdef ;
6
+
7
+ fuzz_target ! ( |data: & [ u8 ] | -> Corpus { traversal_fuzz:: try_traverse_table:: <Gdef >( data, false ) } ) ;
Original file line number Diff line number Diff line change
1
+ #![ no_main]
2
+
3
+ mod traversal_fuzz;
4
+ use libfuzzer_sys:: { fuzz_target, Corpus } ;
5
+ use read_fonts:: tables:: gpos:: Gpos ;
6
+
7
+ fuzz_target ! ( |data: & [ u8 ] | -> Corpus { traversal_fuzz:: try_traverse_table:: <Gpos >( data, false ) } ) ;
Original file line number Diff line number Diff line change
1
+ #![ no_main]
2
+
3
+ mod traversal_fuzz;
4
+ use libfuzzer_sys:: { fuzz_target, Corpus } ;
5
+ use read_fonts:: tables:: gsub:: Gsub ;
6
+
7
+ fuzz_target ! ( |data: & [ u8 ] | -> Corpus { traversal_fuzz:: try_traverse_table:: <Gsub >( data, false ) } ) ;
Original file line number Diff line number Diff line change
1
+ use std:: fmt:: Debug ;
2
+ use std:: io:: Write ;
3
+
4
+ use libfuzzer_sys:: Corpus ;
5
+ use read_fonts:: FontRead ;
6
+
7
+ /// Reusable entry point to fuzz any table via traversal
8
+ ///
9
+ /// To debug timeouts, set `print_output` to `true` (the output text will help
10
+ /// show where you're hitting a loop)
11
+ pub fn try_traverse_table < ' a , T : FontRead < ' a > + Debug > (
12
+ data : & ' a [ u8 ] ,
13
+ print_output : bool ,
14
+ ) -> Corpus {
15
+ match T :: read ( data. into ( ) ) {
16
+ Err ( _) => Corpus :: Reject ,
17
+ Ok ( table) => {
18
+ if print_output {
19
+ eprintln ! ( "{table:?}" ) ;
20
+ } else {
21
+ // if we don't want to see the output don't bother filling a buffer
22
+ let mut empty = std:: io:: empty ( ) ;
23
+ write ! ( & mut empty, "{table:?}" ) . unwrap ( ) ;
24
+ }
25
+ Corpus :: Keep
26
+ }
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments