On Thu, 2005-09-15 at 07:27 -0600, Tom Tromey wrote: > Actually we ought to try reading until we get all 4 bytes or see EOF. > A short read is valid and not an error.
Ok, how about this? 2005-09-14 Anthony Green <[EMAIL PROTECTED]> * java/util/zip/ZipFile.java (checkZipFile): Make sure we read all 4 bytes of the magic number. Index: java/util/zip/ZipFile.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/util/zip/ZipFile.java,v retrieving revision 1.26 diff -u -r1.26 ZipFile.java --- java/util/zip/ZipFile.java 13 Sep 2005 22:19:15 -0000 1.26 +++ java/util/zip/ZipFile.java 15 Sep 2005 15:03:56 -0000 @@ -144,9 +144,18 @@ private void checkZipFile() throws IOException, ZipException { byte[] magicBuf = new byte[4]; - raf.read(magicBuf); + boolean validRead = true; - if (readLeInt(magicBuf, 0) != LOCSIG) + try + { + raf.readFully (magicBuf); + } + catch (EOFException) + { + validRead = false; + } + + if (validRead == false || readLeInt(magicBuf, 0) != LOCSIG) { raf.close(); throw new ZipException("Not a valid zip file"); _______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches