diff --git a/src/write.rs b/src/write.rs index 26667882..b1e62b3a 100644 --- a/src/write.rs +++ b/src/write.rs @@ -142,14 +142,14 @@ pub struct FileOptions { impl arbitrary::Arbitrary for FileOptions { fn arbitrary(u: &mut Unstructured) -> arbitrary::Result { let mut options = FileOptions { - compression_method: CompressionMethod::arbitrary(&mut u), - compression_level: Option::::arbitrary(&mut u), - last_modified_time: DateTime::arbitrary(&mut u), - permissions: Option::::arbitrary(&mut u), - large_file: bool::arbitrary(&mut u), - encrypt_with: Option::::arbitrary(&mut u), - extra_data: Vec::with_capacity(u16::MAX as usize), - central_extra_data: Vec::with_capacity(u16::MAX as usize), + compression_method: CompressionMethod::arbitrary(&mut u)?, + compression_level: Option::::arbitrary(&mut u)?, + last_modified_time: DateTime::arbitrary(&mut u)?, + permissions: Option::::arbitrary(&mut u)?, + large_file: bool::arbitrary(&mut u)?, + encrypt_with: Option::::arbitrary(&mut u)?, + extra_data: Vec::with_capacity(u16::MAX as usize)?, + central_extra_data: Vec::with_capacity(u16::MAX as usize)?, }; #[derive(arbitrary::Arbitrary)] struct ExtraDataField { @@ -157,12 +157,12 @@ impl arbitrary::Arbitrary for FileOptions { data: Vec, central_only: bool, } - let extra_data = Vec::::arbitrary(&mut u); + let extra_data = Vec::::arbitrary(&mut u)?; for field in extra_data { let _ = options.add_extra_data(field.header_id, field.data.as_slice(), field.central_only); } - options + Ok(options) } }