• Joe Tsai's avatar
    archive/zip: fix handling of Info-ZIP Unix extended timestamps · 9697a119
    Joe Tsai authored
    The Info-ZIP Unix1 extra field is specified as such:
    >>>
    Value    Size   Description
    -----    ----   -----------
    0x5855   Short  tag for this extra block type ("UX")
    TSize    Short  total data size for this block
    AcTime   Long   time of last access (GMT/UTC)
    ModTime  Long   time of last modification (GMT/UTC)
    <<<
    
    The previous handling was incorrect in that it read the AcTime field
    instead of the ModTime field.
    
    The test-osx.zip test unfortunately locked in the wrong behavior.
    Manually parsing that ZIP file shows that the encoded MS-DOS
    date and time are 0x4b5f and 0xa97d, which corresponds with a
    date of 2017-10-31 21:11:58, which matches the correct mod time
    (off by 1 second due to MS-DOS timestamp resolution).
    
    Fixes #23901
    
    Change-Id: I567824c66e8316b9acd103dbecde366874a4b7ef
    Reviewed-on: https://go-review.googlesource.com/96895
    Run-TryBot: Joe Tsai <joetsai@google.com>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    9697a119
reader.go 17.3 KB