diff --git a/fuzz/fuzz_targets/fuzz_write.rs b/fuzz/fuzz_targets/fuzz_write.rs index e56add51..104c139a 100644 --- a/fuzz/fuzz_targets/fuzz_write.rs +++ b/fuzz/fuzz_targets/fuzz_write.rs @@ -16,7 +16,10 @@ const LARGE_FILE_BUF_SIZE: usize = u32::MAX as usize + 1; #[derive(Arbitrary, Clone, Debug)] pub enum RepeatedBytes { - Once(Vec), + Once { + min_bytes: [u8; 1024], + extra_bytes: Vec + }, U8Times { bytes: Vec, repeats: u8, @@ -32,7 +35,9 @@ impl IntoIterator for RepeatedBytes { type IntoIter = Flatten>>>; fn into_iter(self) -> Self::IntoIter { match self { - RepeatedBytes::Once(bytes) => { + RepeatedBytes::Once {min_bytes, extra_bytes} => { + let mut bytes = min_bytes.to_vec(); + bytes.extend(extra_bytes); repeat(bytes).take(1) }, RepeatedBytes::U8Times {bytes, repeats} => { @@ -102,7 +107,7 @@ fn do_operation(writer: &mut zip_next::ZipWriter, let written: usize = 0; while written < LARGE_FILE_BUF_SIZE { for chunk in &file.large_contents { - let chunk: Vec = chunk.iter() + let chunk: Vec = chunk.to_owned().into_iter() .flat_map(RepeatedBytes::into_iter) .collect(); writer.write_all(chunk.as_slice())?;