diff options
author | Rex Hoffman <rexhoffman@google.com> | 2022-12-01 20:46:08 +0000 |
---|---|---|
committer | Rex Hoffman <rexhoffman@google.com> | 2022-12-01 20:46:08 +0000 |
commit | a8033c94db8a676d095f588158c219435d79b0a0 (patch) | |
tree | 94204249e34cbd21b1453cf27d9125f31034b227 | |
parent | ebaac47e4edcc5a04048c822bcba5bf5805e3fe6 (diff) |
Support robolectric zip expectations (similar to command line zip)
Test: mma in /external/robolectric
Bug: 244627502
Change-Id: Id6b2b0bdb7b666a1e598b5451f869bf3d56953e5
Merged-In: Id6b2b0bdb7b666a1e598b5451f869bf3d56953e5
-rw-r--r-- | third_party/zip/writer.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/third_party/zip/writer.go b/third_party/zip/writer.go index f5268385d..8a957e163 100644 --- a/third_party/zip/writer.go +++ b/third_party/zip/writer.go @@ -162,9 +162,17 @@ func (w *Writer) Close() error { if records > uint16max { records = uint16max } + // Only store uint32max for the size and the offset if they don't fit. + // Robolectric currently doesn't support zip64 and fails to find the + // offset to the central directory when the number of files in the zip + // is larger than 2^16. + if size > uint32max { + size = uint32max + } + if offset > uint32max { + offset = uint32max + } // END ANDROID CHANGE - size = uint32max - offset = uint32max } // write end record |