You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When writing a zip file, if I used .large_file(true) the file is written with an incorrect CRC. This causes 7-Zip and Windows Explorer at least to fail to extract the zip. CRC errors are also shown by unzip -t from the command line.
The problem does not occur with .large_file(false).
To Reproduce
Steps to reproduce the behaviour:
Build and run this code to create test.zip:
use std::{fs::File, io::Write};use zip::write::{SimpleFileOptions,ZipWriter};fnmain(){let file = File::create("test.zip").unwrap();letmut zip = ZipWriter::new(file);let options = SimpleFileOptions::default().compression_method(zip::CompressionMethod::Stored).large_file(true);
zip.start_file("hello_world.txt", options).unwrap();
zip.write(b"Hello\nWorld!").unwrap();
zip.finish().unwrap();}
Run unzip -t test.zip from the command line. It will show these errors:
$ unzip -t test.zip
Archive: test.zip
testing: hello_world.txt bad CRC d7daaffa (should be 77e47a71)
At least one error was detected in test.zip.
Try to extract test.zip using 7-Zip. It will show these errors:
1 C:\Work\experiments\rust\zip_test\test.zip
Unexpected end of data
2 CRC failed : hello_world.txt
Try to "Extract All.." the file within Windows Explorer. It will fail with error 0x80004005: Unspecified error on hello_world.txt.
Note that this all works without errors if .large_file(true) is removed. The file reads correctly using the zip crate itself, which might indicate problems with the reader as well.
Expected behavior
The zip file should not produce errors with unzip -t and should open and extract correctly with other programs. Maybe tests should be added to check files with unzip -t to avoid this type of error in the future.
Screenshots
The Window Explorer error:
Desktop (please complete the following information):
OS: Windows 10
Crate version: 2.1.3
The text was updated successfully, but these errors were encountered:
Describe the bug
When writing a zip file, if I used
.large_file(true)
the file is written with an incorrect CRC. This causes 7-Zip and Windows Explorer at least to fail to extract the zip. CRC errors are also shown byunzip -t
from the command line.The problem does not occur with
.large_file(false)
.To Reproduce
Steps to reproduce the behaviour:
test.zip
:unzip -t test.zip
from the command line. It will show these errors:0x80004005: Unspecified error
onhello_world.txt
.Note that this all works without errors if
.large_file(true)
is removed. The file reads correctly using thezip
crate itself, which might indicate problems with the reader as well.Expected behavior
The zip file should not produce errors with
unzip -t
and should open and extract correctly with other programs. Maybe tests should be added to check files withunzip -t
to avoid this type of error in the future.Screenshots
The Window Explorer error:
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: