diff -r b52a38d4536c -r 189b26e3818f src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java --- a/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java Fri Dec 21 08:45:43 2012 -0800 +++ b/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java Fri Dec 21 15:27:55 2012 +0000 @@ -548,17 +548,15 @@ } if (i >= 0) { - zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12) + 2]; - zipDir[0] = endbuf[i + 10]; - zipDir[1] = endbuf[i + 11]; + zipDir = new byte[get4ByteLittleEndian(endbuf, i + 12)]; int sz = get4ByteLittleEndian(endbuf, i + 16); // a negative offset or the entries field indicates a // potential zip64 archive - if (sz < 0 || get2ByteLittleEndian(zipDir, 0) == 0xffff) { + if (sz < 0 || get2ByteLittleEndian(endbuf, i + 10) == 0xffff) { throw new ZipFormatException("detected a zip64 archive"); } zipRandomFile.seek(start + sz); - zipRandomFile.readFully(zipDir, 2, zipDir.length - 2); + zipRandomFile.readFully(zipDir, 0, zipDir.length); return; } else { endbufend = endbufpos + 21; @@ -568,14 +566,13 @@ } private void buildIndex() throws IOException { - int entryCount = get2ByteLittleEndian(zipDir, 0); + int len = zipDir.length; // Add each of the files - if (entryCount > 0) { + if (len > 0) { directories = new LinkedHashMap(); ArrayList entryList = new ArrayList(); - int pos = 2; - for (int i = 0; i < entryCount; i++) { + for (int pos = 0; pos < len; ) { pos = readEntry(pos, entryList, directories); }