-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
89 additions
and
2 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
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,19 @@ | ||
[package] | ||
name = "zcash_script-fuzz" | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
libfuzzer-sys = "0.4" | ||
zcash_script = { path = "..", features = ["test-dependencies"] } | ||
|
||
[[bin]] | ||
name = "compare" | ||
path = "fuzz_targets/compare.rs" | ||
test = false | ||
doc = false | ||
bench = false |
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,24 @@ | ||
#![no_main] | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
extern crate zcash_script; | ||
|
||
use zcash_script::*; | ||
|
||
fn missing_sighash(_script_code: &[u8], _hash_type: HashType) -> Option<[u8; 32]> { | ||
None | ||
} | ||
|
||
fuzz_target!(|tup: (i64, bool, &[u8], &[u8], u32)| { | ||
// `fuzz_target!` doesn’t support pattern matching in the parameter list. | ||
let (lock_time, is_final, pub_key, sig, flags) = tup; | ||
let ret = check_verify_callback::<Cxx, Rust>( | ||
&missing_sighash, | ||
lock_time, | ||
is_final, | ||
pub_key, | ||
sig, | ||
testing::repair_flags(VerificationFlags::from_bits_truncate(flags)), | ||
); | ||
assert_eq!(ret.0, ret.1); | ||
}); |
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