1
1
mirror of https://github.com/wader/fq.git synced 2024-11-29 12:14:17 +03:00
fq/format/zip/testdata/zip64-offset-not-ffffffff.zip.fqtest
Mattias Wadman a83cac6021 zip: Fix incorrect time/date, add extended timestamp and refactor
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
2023-10-23 11:11:27 +02:00

124 lines
13 KiB
Plaintext

# from https://github.com/nih-at/libzip/blob/main/regress/zip64.zip
$ fq dv zip64-offset-not-ffffffff.zip
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: zip64-offset-not-ffffffff.zip (zip) 0x0-0xc6 (198)
| | | local_files[0:1]: 0x0-0x35 (53)
| | | [0]{}: local_file 0x0-0x35 (53)
0x00|50 4b 03 04 |PK.. | signature: raw bits (valid) 0x0-0x4 (4)
0x00| 2d 00 | -. | version_needed: 45 0x4-0x6 (2)
| | | flags{}: 0x6-0x8 (2)
0x00| 00 | . | unused0: 0 0x6-0x6.1 (0.1)
0x00| 00 | . | strong_encryption: false 0x6.1-0x6.2 (0.1)
0x00| 00 | . | compressed_patched_data: false 0x6.2-0x6.3 (0.1)
0x00| 00 | . | enhanced_deflation: false 0x6.3-0x6.4 (0.1)
0x00| 00 | . | data_descriptor: false 0x6.4-0x6.5 (0.1)
0x00| 00 | . | compression0: false 0x6.5-0x6.6 (0.1)
0x00| 00 | . | compression1: false 0x6.6-0x6.7 (0.1)
0x00| 00 | . | encrypted: false 0x6.7-0x7 (0.1)
0x00| 00 | . | reserved0: 0 0x7-0x7.2 (0.2)
0x00| 00 | . | mask_header_values: false 0x7.2-0x7.3 (0.1)
0x00| 00 | . | reserved1: false 0x7.3-0x7.4 (0.1)
0x00| 00 | . | language_encoding: false 0x7.4-0x7.5 (0.1)
0x00| 00 | . | unused1: 0 0x7.5-0x8 (0.3)
0x00| 00 00 | .. | compression_method: "none" (0) 0x8-0xa (2)
| | | last_modification{}: 0xa-0xe (4)
0x00| 4f 72 | Or | fat_time: 0x724f 0xa-0xc (2)
| | | second: 30 (15)
| | | minute: 18
| | | hour: 14
0x00| 5b 40 | [@ | fat_date: 0x405b 0xc-0xe (2)
| | | day: 27
| | | month: 2
| | | year: 2012 (32)
| | | unix_guess: 1330352310 (2012-02-27T14:18:30)
0x00| 07 a1| ..| crc32_uncompressed: 0xddeaa107 0xe-0x12 (4)
0x10|ea dd |.. |
0x10| ff ff ff ff | .... | compressed_size: 4294967295 0x12-0x16 (4)
0x10| ff ff ff ff | .... | uncompressed_size: 4294967295 0x16-0x1a (4)
0x10| 01 00 | .. | file_name_length: 1 0x1a-0x1c (2)
0x10| 14 00 | .. | extra_field_length: 20 0x1c-0x1e (2)
0x10| 2d | - | file_name: "-" 0x1e-0x1f (1)
| | | extra_fields[0:1]: 0x1f-0x33 (20)
| | | [0]{}: extra_field 0x1f-0x33 (20)
0x10| 01| .| tag: 0x1 (ZIP64 extended information extra field) 0x1f-0x21 (2)
0x20|00 |. |
0x20| 10 00 | .. | size: 16 0x21-0x23 (2)
0x20| 02 00 00 00 00 00 00 00 | ........ | uncompressed_size: 2 0x23-0x2b (8)
0x20| 02 00 00 00 00| .....| compressed_size: 2 0x2b-0x33 (8)
0x30|00 00 00 |... |
0x30| 61 0a | a. | uncompressed: raw bits 0x33-0x35 (2)
| | | central_directories[0:1]: 0x35-0x64 (47)
| | | [0]{}: central_directory 0x35-0x64 (47)
0x30| 50 4b 01 02 | PK.. | signature: raw bits (valid) 0x35-0x39 (4)
0x30| 1e 03 | .. | version_made_by: 798 0x39-0x3b (2)
0x30| 2d 00 | -. | version_needed: 45 0x3b-0x3d (2)
| | | flags{}: 0x3d-0x3f (2)
0x30| 00 | . | unused0: 0 0x3d-0x3d.1 (0.1)
0x30| 00 | . | strong_encryption: false 0x3d.1-0x3d.2 (0.1)
0x30| 00 | . | compressed_patched_data: false 0x3d.2-0x3d.3 (0.1)
0x30| 00 | . | enhanced_deflation: false 0x3d.3-0x3d.4 (0.1)
0x30| 00 | . | data_descriptor: false 0x3d.4-0x3d.5 (0.1)
0x30| 00 | . | compression0: false 0x3d.5-0x3d.6 (0.1)
0x30| 00 | . | compression1: false 0x3d.6-0x3d.7 (0.1)
0x30| 00 | . | encrypted: false 0x3d.7-0x3e (0.1)
0x30| 00 | . | reserved0: 0 0x3e-0x3e.2 (0.2)
0x30| 00 | . | mask_header_values: false 0x3e.2-0x3e.3 (0.1)
0x30| 00 | . | reserved1: false 0x3e.3-0x3e.4 (0.1)
0x30| 00 | . | language_encoding: false 0x3e.4-0x3e.5 (0.1)
0x30| 00 | . | unused1: 0 0x3e.5-0x3f (0.3)
0x30| 00| .| compression_method: "none" (0) 0x3f-0x41 (2)
0x40|00 |. |
| | | last_modification{}: 0x41-0x45 (4)
0x40| 4f 72 | Or | fat_time: 0x724f 0x41-0x43 (2)
| | | second: 30 (15)
| | | minute: 18
| | | hour: 14
0x40| 5b 40 | [@ | fat_date: 0x405b 0x43-0x45 (2)
| | | day: 27
| | | month: 2
| | | year: 2012 (32)
| | | unix_guess: 1330352310 (2012-02-27T14:18:30)
0x40| 07 a1 ea dd | .... | crc32_uncompressed: 0xddeaa107 0x45-0x49 (4)
0x40| 02 00 00 00 | .... | compressed_size: 2 0x49-0x4d (4)
0x40| 02 00 00| ...| uncompressed_size: 2 0x4d-0x51 (4)
0x50|00 |. |
0x50| 01 00 | .. | file_name_length: 1 0x51-0x53 (2)
0x50| 00 00 | .. | extra_field_length: 0 0x53-0x55 (2)
0x50| 00 00 | .. | file_comment_length: 0 0x55-0x57 (2)
0x50| 00 00 | .. | disk_number_where_file_starts: 0 0x57-0x59 (2)
0x50| 01 00 | .. | internal_file_attributes: 1 0x59-0x5b (2)
0x50| 00 00 80 11 | .... | external_file_attributes: 293601280 0x5b-0x5f (4)
0x50| 00| .| relative_offset_of_local_file_header: 0 0x5f-0x63 (4)
0x60|00 00 00 |... |
0x60| 2d | - | file_name: "-" 0x63-0x64 (1)
| | | extra_fields[0:0]: 0x64-0x64 (0)
| | | file_comment: "" 0x64-0x64 (0)
| | | end_of_central_directory_record_zip64{}: 0x64-0x9c (56)
0x60| 50 4b 06 06 | PK.. | signature: raw bits (valid) 0x64-0x68 (4)
0x60| 2c 00 00 00 00 00 00 00| ,.......| size_of_end_of_central_directory: 44 0x68-0x70 (8)
0x70|1e 03 |.. | version_made_by: 798 0x70-0x72 (2)
0x70| 2d 00 | -. | version_needed_to_extract: 45 0x72-0x74 (2)
0x70| 00 00 00 00 | .... | disk_nr: 0 0x74-0x78 (4)
0x70| 00 00 00 00 | .... | central_directory_start_disk_nr: 0 0x78-0x7c (4)
0x70| 01 00 00 00| ....| nr_of_central_directory_records_on_disk: 1 0x7c-0x84 (8)
0x80|00 00 00 00 |.... |
0x80| 01 00 00 00 00 00 00 00 | ........ | nr_of_central_directory_records: 1 0x84-0x8c (8)
0x80| 2f 00 00 00| /...| size_of_central_directory: 47 0x8c-0x94 (8)
0x90|00 00 00 00 |.... |
0x90| 35 00 00 00 00 00 00 00 | 5....... | offset_of_start_of_central_directory: 53 0x94-0x9c (8)
| | | extensible_data[0:0]: 0x9c-0x9c (0)
| | | end_of_central_directory_locator{}: 0x9c-0xb0 (20)
0x90| 50 4b 06 07| PK..| signature: raw bits (valid) 0x9c-0xa0 (4)
0xa0|00 00 00 00 |.... | disk_nr: 0 0xa0-0xa4 (4)
0xa0| 64 00 00 00 00 00 00 00 | d....... | offset_of_end_of_central_directory_record: 100 0xa4-0xac (8)
0xa0| 01 00 00 00| ....| total_disk_nr: 1 0xac-0xb0 (4)
| | | end_of_central_directory_record{}: 0xb0-0xc6 (22)
0xb0|50 4b 05 06 |PK.. | signature: raw bits (valid) 0xb0-0xb4 (4)
0xb0| 00 00 | .. | disk_nr: 0 0xb4-0xb6 (2)
0xb0| 00 00 | .. | central_directory_start_disk_nr: 0 0xb6-0xb8 (2)
0xb0| 01 00 | .. | nr_of_central_directory_records_on_disk: 1 0xb8-0xba (2)
0xb0| 01 00 | .. | nr_of_central_directory_records: 1 0xba-0xbc (2)
0xb0| 2f 00 00 00| /...| size_of_central_directory: 47 0xbc-0xc0 (4)
0xc0|35 00 00 00 |5... | offset_of_start_of_central_directory: 53 0xc0-0xc4 (4)
0xc0| 00 00| | ..| | comment_length: 0 0xc4-0xc6 (2)
| | | comment: "" 0xc6-0xc6 (0)