public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Kresten Krab Thorup <krab@gnu.org> To: java-gnats@sourceware.cygnus.com Subject: libgcj/1268: java/util/zip/ZipFile reads directory incorrectly Date: Wed, 20 Dec 2000 12:23:00 -0000 [thread overview] Message-ID: <19990809131144.19026.qmail@egcs.cygnus.com> (raw) >Number: 1268 >Category: libgcj >Synopsis: java/util/zip/ZipFile reads directory incorrectly >Confidential: no >Severity: serious >Priority: high >Responsible: java-hacker >State: closed >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Dec 20 12:18:30 PST 2000 >Closed-Date: Sun Apr 02 20:27:35 PDT 2000 >Last-Modified: Sun Apr 2 20:30:01 PDT 2000 >Originator: Kresten Krab Thorup <krab@gnu.org> >Release: snapshot aug-09-99 20:00 >Organization: >Environment: >Description: The ZipFile class does not read the zip file central directory correctly. The result is, that classes cannot be loaded from zip or jar files. The class loader reports "erroneous magic number". >How-To-Repeat: Run the verifier (available from krab@gnu.org) on itself, gij verify.Tool --classpath=.:path/to/libgcj.zip This will trigger the verifier to load class java.lang.String from the zip file, which will not work. >Fix: 1999-11-07 Anthony Green <green@cygnus.com> * java/util/zip/ZipFile.java: Compute the offset of the ZipEntry data correctly. Index: libjava/java/util/zip/ZipFile.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/util/zip/ZipFile.java,v retrieving revision 1.4 diff -u -r1.4 ZipFile.java --- ZipFile.java 1999/08/18 14:16:41 1.4 +++ ZipFile.java 1999/11/07 08:18:34 @@ -122,10 +122,13 @@ public InputStream getInputStream(ZipEntry ze) throws IOException { byte[] buffer = new byte[(int) ze.getSize()]; - int data_offset = ZipConstants.LOCAL_FILE_HEADER_SIZE + name.length(); - if (ze.extra != null) - data_offset += ze.extra.length; - file.seek(ze.relativeOffset + data_offset); + + /* Read the size of the extra field, and skip to the start of the + data. */ + file.seek (ze.relativeOffset + ZipConstants.LOCAL_FILE_HEADER_SIZE - 2); + int extraFieldLength = readu2(); + file.skipBytes (ze.getName().length() + extraFieldLength); + file.readFully(buffer); InputStream is = new ByteArrayInputStream (buffer); >Release-Note: >Audit-Trail: Formerly PR java.util/25 Responsible-Changed-From-To: apbianco->java-hacker Responsible-Changed-By: apbianco Responsible-Changed-When: Fri Aug 20 00:36:37 1999 Responsible-Changed-Why: The reflect the category change from `gcj' to `libgcj'. State-Changed-From-To: open->feedback State-Changed-By: green State-Changed-When: Sun Nov 7 00:33:59 1999 State-Changed-Why: I've committed a fix to the problem. Let me know if it works for you and I'll close this. From: green@cygnus.com To: green@cygnus.com, java-gnats@sourceware.cygnus.com, krab@gnu.org Cc: Subject: Re: java.util/25 Date: 7 Nov 1999 08:33:59 -0000 Synopsis: java/util/zip/ZipFile reads directory incorrectly State-Changed-From-To: open->feedback State-Changed-By: green State-Changed-When: Sun Nov 7 00:33:59 1999 State-Changed-Why: I've committed a fix to the problem. Let me know if it works for you and I'll close this. http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&database=java&pr=25 State-Changed-From-To: feedback->closed State-Changed-By: green State-Changed-When: Sun Apr 2 20:27:35 2000 State-Changed-Why: This was fixed some time ago. I'm just going to close it now. From: green@cygnus.com To: green@cygnus.com, java-gnats@sourceware.cygnus.com, krab@gnu.org Cc: Subject: Re: java.util/25 Date: 3 Apr 2000 03:27:35 -0000 Synopsis: java/util/zip/ZipFile reads directory incorrectly State-Changed-From-To: feedback->closed State-Changed-By: green State-Changed-When: Sun Apr 2 20:27:35 2000 State-Changed-Why: This was fixed some time ago. I'm just going to close it now. http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=25&database=java >Unformatted:
reply other threads:[~2000-12-20 12:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=19990809131144.19026.qmail@egcs.cygnus.com \ --to=krab@gnu.org \ --cc=java-gnats@sourceware.cygnus.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).