File tree 2 files changed +38
-1
lines changed
2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -43,4 +43,8 @@ path = "fuzz_targets/roundtrip_semantic.rs"
43
43
44
44
[[bin ]]
45
45
name = " compile_descriptor"
46
- path = " fuzz_targets/compile_descriptor.rs"
46
+ path = " fuzz_targets/compile_descriptor.rs"
47
+
48
+ [[bin ]]
49
+ name = " parse_descriptor"
50
+ path = " fuzz_targets/parse_descriptor.rs"
Original file line number Diff line number Diff line change
1
+ extern crate miniscript;
2
+
3
+ use miniscript:: descriptor:: DescriptorPublicKey ;
4
+ use std:: str:: FromStr ;
5
+
6
+ fn do_test ( data : & [ u8 ] ) {
7
+ let data_str = String :: from_utf8_lossy ( data) ;
8
+ if let Ok ( dpk) = DescriptorPublicKey :: from_str ( & data_str) {
9
+ let output = dpk. to_string ( ) ;
10
+ assert_eq ! ( data_str. to_lowercase( ) , output. to_lowercase( ) ) ;
11
+ }
12
+ }
13
+
14
+ #[ cfg( feature = "afl" ) ]
15
+ extern crate afl;
16
+ #[ cfg( feature = "afl" ) ]
17
+ fn main ( ) {
18
+ afl:: read_stdio_bytes ( |data| {
19
+ do_test ( & data) ;
20
+ } ) ;
21
+ }
22
+
23
+ #[ cfg( feature = "honggfuzz" ) ]
24
+ #[ macro_use]
25
+ extern crate honggfuzz;
26
+ #[ cfg( feature = "honggfuzz" ) ]
27
+ fn main ( ) {
28
+ loop {
29
+ fuzz ! ( |data| {
30
+ do_test( data) ;
31
+ } ) ;
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments