Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore fuzz harness #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions fuzz/fuzz_targets/fuzz_encode_reconstruct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[macro_use] extern crate libfuzzer_sys;
extern crate reed_solomon_erasure;

use reed_solomon_erasure::ReedSolomon;
use reed_solomon_erasure::{galois_8, ReedSolomon};

fuzz_target!(|data: &[u8]| {
if data.len() >= 7 {
Expand All @@ -24,7 +24,8 @@ fuzz_target!(|data: &[u8]| {
&& data_shards + parity_shards <= 256
&& data.len() == data_shards * shard_size
{
let codec = ReedSolomon::new(data_shards, parity_shards).unwrap();
let codec: ReedSolomon<galois_8::Field> =
ReedSolomon::new(data_shards, parity_shards).unwrap();

for _ in 0..run_count {
assert_eq!(codec.data_shard_count(), data_shards);
Expand Down Expand Up @@ -99,8 +100,10 @@ fuzz_target!(|data: &[u8]| {
slices.push(p);
}

codec.reconstruct(&mut slices,
&mut slice_present).unwrap();
let mut x: Vec<(&mut [u8], bool)> =
slices.into_iter().zip(slice_present.into_iter()).collect();

codec.reconstruct(&mut x).unwrap();
}

{
Expand Down
5 changes: 3 additions & 2 deletions fuzz/fuzz_targets/fuzz_encode_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[macro_use] extern crate libfuzzer_sys;
extern crate reed_solomon_erasure;

use reed_solomon_erasure::ReedSolomon;
use reed_solomon_erasure::{galois_8, ReedSolomon};

fuzz_target!(|data: &[u8]| {
if data.len() >= 4 {
Expand All @@ -19,7 +19,8 @@ fuzz_target!(|data: &[u8]| {
&& data_shards + parity_shards <= 256
&& data.len() == data_shards * shard_size
{
let codec = ReedSolomon::new(data_shards, parity_shards).unwrap();
let codec: ReedSolomon<galois_8::Field> =
ReedSolomon::new(data_shards, parity_shards).unwrap();

for _ in 0..run_count {
assert_eq!(codec.data_shard_count(), data_shards);
Expand Down