-
Notifications
You must be signed in to change notification settings - Fork 57
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
2 changed files
with
22 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,16 @@ | ||
#![no_main] | ||
use clvmr::keccak256_ops::op_keccak256; | ||
use clvmr::{reduction::Reduction, Allocator, NodePtr}; | ||
use libfuzzer_sys::fuzz_target; | ||
|
||
fuzz_target!(|data: &[u8]| { | ||
let mut a = Allocator::new(); | ||
let blob = a.new_atom(data).expect("failed to create atom"); | ||
let args = a | ||
.new_pair(blob, NodePtr::NIL) | ||
.expect("failed to create pair"); | ||
let Reduction(cost, node) = op_keccak256(&mut a, args, 11000000000).expect("keccak256 failed"); | ||
assert!(cost >= 210); | ||
assert!(node.is_atom()); | ||
assert_eq!(a.atom_len(node), 32); | ||
}); |