src/java.base/share/classes/java/util/zip/ZipFile.java

Print this page

        

@@ -1249,11 +1249,11 @@
                          }
                     }
                     idx = getEntryNext(idx);
                 }
                 /* If not addSlash, or slash is already there, we are done */
-                if (!addSlash  || name[name.length - 1] == '/') {
+                if (!addSlash  || name.length == 0 || name[name.length - 1] == '/') {
                      return -1;
                 }
                 /* Add slash and try once more */
                 name = Arrays.copyOf(name, name.length + 1);
                 name[name.length - 1] = '/';