summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRex Hoffman <rexhoffman@google.com>2022-12-06 19:07:44 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-12-06 19:07:44 +0000
commit91c22dc45e6d5e59ea5bad64c4d02fb28da01d90 (patch)
tree85f479e7dac1b9587a5fbf8182e084b00467cd37
parentc07abe9ad24a10c738ff608f9f4ceb301f642d6d (diff)
parenta8033c94db8a676d095f588158c219435d79b0a0 (diff)
Support robolectric zip expectations (similar to command line zip) am: a8033c94db
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/20611145 Change-Id: I73b97924cd62cf5454766d6a4afa124cb75c93b3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--third_party/zip/writer.go12
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