Skip to content

Commit a17b34c

Browse files
committed
Merge #787: fuzz: add target for Descriptor::parse_descriptor
eb1e9f6 fuzz: add target for `Descriptor::parse_descriptor` (Bruno Garcia) Pull request description: ACKs for top commit: sanket1729: ACK eb1e9f6 apoelstra: ACK eb1e9f6; successfully ran local tests; thanks! Tree-SHA512: bec4da195b0f7370b81a62f1f2c92d84f862ca1ebfaee3f8fcc22d858fccdd15390f9839beaef7a6e6dac8b17484e534cce4581fb7b11f82df360e88c75ce0c3
2 parents f3704d1 + eb1e9f6 commit a17b34c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

fuzz/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ path = "fuzz_targets/compile_taproot.rs"
3030
name = "parse_descriptor"
3131
path = "fuzz_targets/parse_descriptor.rs"
3232

33+
[[bin]]
34+
name = "parse_descriptor_priv"
35+
path = "fuzz_targets/parse_descriptor_priv.rs"
36+
3337
[[bin]]
3438
name = "parse_descriptor_secret"
3539
path = "fuzz_targets/parse_descriptor_secret.rs"
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#![allow(unexpected_cfgs)]
2+
3+
use honggfuzz::fuzz;
4+
use miniscript::bitcoin::secp256k1;
5+
use miniscript::Descriptor;
6+
7+
fn do_test(data: &[u8]) {
8+
let data_str = String::from_utf8_lossy(data);
9+
let secp = &secp256k1::Secp256k1::signing_only();
10+
11+
if let Ok((desc, _)) = Descriptor::parse_descriptor(secp, &data_str) {
12+
let _output = desc.to_string();
13+
let _sanity_check = desc.sanity_check();
14+
}
15+
}
16+
17+
fn main() {
18+
loop {
19+
fuzz!(|data| {
20+
do_test(data);
21+
});
22+
}
23+
}

0 commit comments

Comments
 (0)