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
zig run extract.zig -- compressed_1.zip && rm file.txt
# Extracted successfully: compressed_1.zip# removed 'file.txt'
zig run extract.zig -- compressed_1.zip && rm file.txt
# error: ZipMismatchCompLen# /home/ks/stuff/zig/zig-linux-x86_64-0.14.0-dev/lib/std/zip.zig:471:25: 0x1058d46 in extract (extract)# return error.ZipMismatchCompLen;# ^# /home/ks/stuff/zig/zig-linux-x86_64-0.14.0-dev/lib/std/zip.zig:588:23: 0x105a47a in extract__anon_1914 (extract)# const crc32 = try entry.extract(seekable_stream, options, &filename_buf, dest);# ^# /home/ks/stuff/zig/ziptest/extract.zig:13:5: 0x105aa06 in main (extract)# try std.zip.extract(std.fs.cwd(), zip_stream, .{});# ^
Expected Behavior
The file compressed_2.zip should be extracted successfully. compressed_2.zip is a perfectly valid zip file that passes integrity checks like:
unzip -t compressed_2.zip
# Archive: compressed_2.zip# testing: file.txt OK# No errors detected in compressed data of compressed_2.zip.
This is happening because the file is created using the -fz flag. I am unsure of zip lore but it causes issue with this part of the zip library's code:
For this particular zip file both local_header.compressed_size and local_header.uncompressed_size are 0xffffffff. The zip spec says something about when these fields are to be 0xffffffff but it goes over my head. Sorry about that.
The text was updated successfully, but these errors were encountered:
Zig Version
0.14.0-dev.2370+5c6b25d9b
Steps to Reproduce and Observed Behavior
1. Prepare the zip files
2. Prepare the zig code to extract said files
3. Extract the zip files
Expected Behavior
The file
compressed_2.zip
should be extracted successfully.compressed_2.zip
is a perfectly valid zip file that passes integrity checks like:This is happening because the file is created using the
-fz
flag. I am unsure of zip lore but it causes issue with this part of the zip library's code:zig/lib/std/zip.zig
Lines 469 to 474 in 30169d1
For this particular zip file both
local_header.compressed_size
andlocal_header.uncompressed_size
are0xffffffff
. The zip spec says something about when these fields are to be0xffffffff
but it goes over my head. Sorry about that.The text was updated successfully, but these errors were encountered: