Zip64 追加情報フィールド

Zip64 追加情報フィールド

zipファイルを分析しようとすると、少し混乱している部分の1つは、ファイルZip64 Extra Information Fieldヘッダー(中央ディレクトリまたはローカル)に特定のフィールドを配置できない場合にファイルが生成されると予想されるため、0xffffffffを挿入します。ファイルヘッダーを追加し、追加情報フィールドに実際の値を入力します。
文書によるとここ、これは構造の背後にある追加フィールドの1つとして見つけることができます。

        Value      Size       Description
        -----      ----       -----------
(ZIP64) 0x0001     2 bytes    Tag for this "extra" block type
        Size       2 bytes    Size of this "extra" block
        Original 
        Size       8 bytes    Original uncompressed file size
        Compressed
        Size       8 bytes    Size of compressed data
        Relative Header
        Offset     8 bytes    Offset of local header record
        Disk Start
        Number     4 bytes    Number of the disk on which
                              this file starts 

これは、拡張情報項目のサイズが常に28バイトであると予想する必要があることを意味します。
ただし、実際のZip64アーカイブを分析すると、ファイルオフセットが0xffffffffの中央ディレクトリエントリが見つかりました。次のステップは、追加データフィールドで0x0001ヘッダーIDを見つけることです(予測データサイズは28バイト)。ただし、(0x0001 header-id、8バイトサイズ、および値が0x02ab6bd436の1つのフィールドに変換されます)、ローカルファイルヘッダーオフセットを正しく表すことがわかり
ました。00 01 00 08 00 36 d4 6b ab 02 00 00 00文書に他のフィールドが記載されていないのはなぜですかZip64 Extra Information Field?私はLinuxシステムで利用可能な
標準ユーティリティを使用しています。zip

ベストアンサー1

もう回答は必要ありませんが、将来の読者には必要だと確信しています。仕様によると、64の追加ブロックフィールドは必要なときにのみ存在する必要があります。

   4.5.3 -Zip64 Extended Information Extra Field (0x0001):

      The following is the layout of the zip64 extended 
      information "extra" block. If one of the size or
      offset fields in the Local or Central directory
      record is too small to hold the required data,
      a Zip64 extended information record is created.
      The order of the fields in the zip64 extended 
      information record is fixed, but the fields MUST
      only appear if the corresponding Local or Central
      directory record field is set to 0xFFFF or 0xFFFFFFFF.

      Note: all fields stored in Intel low-byte/high-byte order.

        Value      Size       Description
        -----      ----       -----------
(ZIP64) 0x0001     2 bytes    Tag for this "extra" block type
        Size       2 bytes    Size of this "extra" block
        Original 
        Size       8 bytes    Original uncompressed file size
        Compressed
        Size       8 bytes    Size of compressed data
        Relative Header
        Offset     8 bytes    Offset of local header record
        Disk Start
        Number     4 bytes    Number of the disk on which
                              this file starts 

したがって、ローカル/中央ディレクトリレコードに0xFFFFまたは0xFFFFFFFFとマークされた内容だけが64 extraブロックに表示される必要があります。

言及した場合、残りのフィールド(非圧縮、圧縮、およびディスク)は、ローカル/中央で正しく認識され、読み取る必要があります。

おすすめ記事