Patch: ZipInputStream fix
Tom Tromey
tromey@cygnus.com
Thu May 11 10:04:00 GMT 2000
I'm checking this in. This fixes a ZipInputStream bug I found while
reading the code a couple weeks ago. The `PK\01\02' entries don't
have any data associated with them, so skipping `size' bytes is
definitely wrong.
2000-05-11 Tom Tromey <tromey@cygnus.com>
* java/util/zip/ZipInputStream.java (getNextEntry): When reading
file headers, don't include `size' in the skip call.
Tom
Index: java/util/zip/ZipInputStream.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/zip/ZipInputStream.java,v
retrieving revision 1.6
diff -u -r1.6 ZipInputStream.java
--- ZipInputStream.java 2000/03/07 19:55:28 1.6
+++ ZipInputStream.java 2000/05/11 16:57:58
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -52,7 +52,13 @@
int fname_length = readu2();
int extra_length = readu2();
int fcomment_length = readu2();
- in.skip(12+fname_length+extra_length+fcomment_length+size);
+ // `12' is the number of bytes between the comment length
+ // field and the end of the fixed part of the header:
+ // 2 bytes for `disk number start'
+ // 2 bytes for `internal file attributes'
+ // 4 bytes for `external file attributes'
+ // 4 bytes for `relative offset of local header'
+ in.skip(12 + fname_length + extra_length + fcomment_length);
if (in.read() != 'P' || in.read() != 'K')
return null;
code = in.read();
More information about the Java-patches
mailing list