]> Cypherpunks repositories - gostls13.git/commit
archive/tar: reapply Header.Size to regFileReader after merging
authorJoe Tsai <joetsai@digital-static.net>
Fri, 2 Sep 2016 21:37:35 +0000 (14:37 -0700)
committerJoe Tsai <thebrokentoaster@gmail.com>
Fri, 2 Sep 2016 21:58:53 +0000 (21:58 +0000)
commit0b84a64da173d811d01a8a59545c22a7e1fd986a
tree4f4a1fc6b2661c4093e47bb843b2c7b96e27fb00
parent549ca046ffeb1f76833c15059d3a5da301cf1eb3
archive/tar: reapply Header.Size to regFileReader after merging

The use of PAX headers can modify the overall file size, thus the
formerly created regFileReader may be stale.

The relevant PAX specification for this behavior is:
<<<
Any fields in the preceding optional extended header shall override
the associated fields in this header block for this file.
>>>
Where "optional extended header" refers to the preceding PAX header.
Where "this header block" refers to the subsequent USTAR header.

Fixes #15573
Fixes #15564

Change-Id: I83b1c3f05a9ca2d3be38647425ad21a9fe450ee2
Reviewed-on: https://go-review.googlesource.com/28418
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/archive/tar/reader.go
src/archive/tar/reader_test.go
src/archive/tar/testdata/pax-pos-size-file.tar [new file with mode: 0644]