diff --git a/src/spec.rs b/src/spec.rs index 7dc8286f..d4c61113 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -264,7 +264,7 @@ impl Zip32CentralDirectoryEnd { number_of_files, central_directory_size, central_directory_offset, - zip_file_comment_length: zip_file_comment.len().try_into().unwrap_or(u16::MAX), + zip_file_comment_length: zip_file_comment.len().try_into().map_err(|_| ZipError::InvalidArchive("File comment must be less than 64 KiB"))?, }; Ok((block, zip_file_comment)) }