-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fuzz: add target for
Descriptor::parse_descriptor
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![allow(unexpected_cfgs)] | ||
|
||
use honggfuzz::fuzz; | ||
use miniscript::bitcoin::secp256k1; | ||
use miniscript::Descriptor; | ||
|
||
fn do_test(data: &[u8]) { | ||
let data_str = String::from_utf8_lossy(data); | ||
let secp = &secp256k1::Secp256k1::signing_only(); | ||
|
||
if let Ok((desc, _)) = Descriptor::parse_descriptor(secp, &data_str) { | ||
let _output = desc.to_string(); | ||
let _sanity_check = desc.sanity_check(); | ||
} | ||
} | ||
|
||
fn main() { | ||
loop { | ||
fuzz!(|data| { | ||
do_test(data); | ||
}); | ||
} | ||
} |