Menu ▾ ▴

#68 Creating zip with Streamed Zip64 is missing central header records

v1.0 (example)
open
nobody
None
5
2022-08-01
2022-08-01
No

Consider the following command that will force a Zip64 archive with streaming enabled.

$ echo abcde | zip --force-zip64 | cat >/tmp/x1.zip

This is what unzip (on a very recent Ubuntu) thinks of the zip file

$ unzip -t /tmp/x1.zip 
Archive:  /tmp/x1.zip
error [/tmp/x1.zip]:  missing 4294967212 bytes in zipfile
  (attempting to process anyway)
error: invalid zip file with overlapped components (possible zip bomb)

Below is a dump of the internal structure of the zip file created with zipdetails. Note the absence of both of the Zip64 records ( zip64 end of central directory record and zip64 end of central directory locator) that should be present in the central directory

$zipdetails --scan /tmp/x1.zip

0000 LOCAL HEADER #1       04034B50
0004 Extract Zip Spec      2D '4.5'
0005 Extract OS            00 'MS-DOS'
0006 General Purpose Flag  0008
     [Bits 1-2]            0 'Normal Compression'
     [Bit  3]              1 'Streamed'
0008 Compression Method    0008 'Deflated'
000A Last Mod Time         55017AE4 'Mon Aug  1 16:23:08 2022'
000E CRC                   00000000
0012 Compressed Length     FFFFFFFF
0016 Uncompressed Length   FFFFFFFF
001A Filename Length       0001
001C Extra Length          0014
001E Filename              '-'
001F Extra ID #0001        0001 'ZIP64'
0021   Length              0010
0023   Uncompressed Size   0000000000000000
002B   Compressed Size     0000000000000000
0033 PAYLOAD

003B STREAMING DATA HEADER 08074B50
003F CRC                   0F8A149C
0043 Compressed Length     0000000000000008
004B Uncompressed Length   0000000000000006

0057 CENTRAL HEADER #1     02014B50
005B Created Zip Spec      1E '3.0'
005C Created OS            03 'Unix'
005D Extract Zip Spec      2D '4.5'
005E Extract OS            00 'MS-DOS'
005F General Purpose Flag  0008
     [Bits 1-2]            0 'Normal Compression'
     [Bit  3]              1 'Streamed'
0061 Compression Method    0008 'Deflated'
0063 Last Mod Time         55017AE4 'Mon Aug  1 16:23:08 2022'
0067 CRC                   0F8A149C
006B Compressed Length     00000008
006F Uncompressed Length   FFFFFFFF
0073 Filename Length       0001
0075 Extra Length          000C
0077 Comment Length        0000
0079 Disk Start            0000
007B Int File Attributes   0001
     [Bit 0]               1 Text Data
007D Ext File Attributes   11800000
0081 Local Header Offset   00000000
0085 Filename              '-'
0086 Extra ID #0001        0001 'ZIP64'
0088   Length              0008
008A   Uncompressed Size   0000000000000006

008E END CENTRAL HEADER    06054B50
0092 Number of this disk   0000
0094 Central Dir Disk no   0000
0096 Entries in this disk  0001
0098 Total Entries         0001
009A Size of Central Dir   0000003B
009E Offset to Central Dir FFFFFFFF
00A2 Comment Length        0000
Done

I suspect that this is a variation on [#61]

1 Attachments

Related

Bugs: #61

Discussion

  • Ed Gordon

    Ed Gordon - 2022-08-01

    The analysis looks right. The --force option seems to be working correctly, but the code that generates the Zip64 headers is not detecting that the headers are needed.

    And it does seem the same issue as #61.

    I'll throw this on the queue of issues with Zip that need to be fixed. It should be a fairly quick fix, but no promises when Zip 3.1 will be released with it.

    Thanks for the feedback.

     

Log in to post a comment.