Skip to content

Commit

Permalink
Support ZIP files with total number of disks = 0 (#15200)
Browse files Browse the repository at this point in the history
We came across [a problem](https://buildkite.com/bazel/intellij-plugin/builds/15968#0863eaa6-499b-46a2-a146-79d4c2b830c0) adding a jar provided by IntelliJ in its 2022.1 (lib/app.jar) to a `java_import` target because the jar in this version has a total number of disks = 0.

This value is supported by other tools: https://github.com/python/cpython/blob/main/Lib/zipfile.py#L258

PiperOrigin-RevId: 440322029

Co-authored-by: messa <[email protected]>
  • Loading branch information
Wyverald and mai93 authored Apr 8, 2022
1 parent 8ae1520 commit 94cc098
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion third_party/ijar/zip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ bool FindZip64CentralDirectory(const u1 *bytes, size_t in_length,
if (MaybeReadZip64CentralDirectory(bytes, in_length,
bytes + zip64_end_of_central_dir_offset,
end_of_central_dir, cd)) {
if (disk_with_zip64_central_directory != 0 || zip64_total_disks != 1) {
// TODO(b/228519294) Add a test for a valid zip64 file with total disks = 0
if (disk_with_zip64_central_directory != 0 || zip64_total_disks > 1) {
fprintf(stderr, "multi-disk JAR files are not supported\n");
return false;
}
Expand Down

0 comments on commit 94cc098

Please sign in to comment.