summaryrefslogtreecommitdiff
path: root/third_party/zip/android.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2023-08-22 14:22:28 -0700
committer Colin Cross <ccross@android.com> 2023-08-22 14:24:25 -0700
commitc2a62d40fa154620c3b3cb2db42756a2abaf062a (patch)
tree1176981d4c703a7fb2d0109641d119b96e5c759b /third_party/zip/android.go
parent516a1882064d1cf50d506b9b5a4a4acf045ed312 (diff)
Strip zip64 extras after writing local header when copying
writeHeader generates zip64 extras that are correct for the local header, but incorrect for the central directory header. Strip the extras again after writeHeader so that the central directory header extras are recreated correctly. Test: Zip2Zip64 Bug: 296314205 Change-Id: I1ca6a5745a9f97426df6c111db444facdfa25b2e
Diffstat (limited to 'third_party/zip/android.go')
-rw-r--r--third_party/zip/android.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/third_party/zip/android.go b/third_party/zip/android.go
index 0f41f6200..b97215689 100644
--- a/third_party/zip/android.go
+++ b/third_party/zip/android.go
@@ -56,6 +56,11 @@ func (w *Writer) CopyFrom(orig *File, newName string) error {
if err := writeHeader(w.cw, fh); err != nil {
return err
}
+
+ // Strip the extras again in case writeHeader added the local file header extras that are incorrect for the
+ // central directory.
+ fh.Extra = stripExtras(fh.Extra)
+
dataOffset, err := orig.DataOffset()
if err != nil {
return err