public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Java Patch List <java-patches@gcc.gnu.org>
Subject: [4.1] Patch: FYI: ZipFile fixlet
Date: Thu, 06 Apr 2006 21:57:00 -0000	[thread overview]
Message-ID: <m3bqve2x12.fsf@localhost.localdomain> (raw)

I'm checking this in.

Currently our ZipFile will fail if you try to get an entry whose name
contains a non-ASCII character.  The length check is incorrect... and
there's really no point to checking the length anyway, as we already
know the entry's name matches.

This is already fixed in Classpath.

Tom

Index: classpath/ChangeLog.gcj
from  Tom Tromey  <tromey@redhat.com>

	* java/util/zip/ZipFile.java (checkLocalHeader): Don't check name
	length.

Index: classpath/java/util/zip/ZipFile.java
===================================================================
--- classpath/java/util/zip/ZipFile.java	(revision 112714)
+++ classpath/java/util/zip/ZipFile.java	(working copy)
@@ -1,5 +1,5 @@
 /* ZipFile.java --
-   Copyright (C) 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -457,10 +457,8 @@
 	if (entry.getMethod() != readLeShort(locBuf, LOCHOW))
 	  throw new ZipException("Compression method mismatch: " + name);
 
-	if (entry.getName().length() != readLeShort(locBuf, LOCNAM))
-	  throw new ZipException("file name length mismatch: " + name);
-
-	int extraLen = entry.getName().length() + readLeShort(locBuf, LOCEXT);
+	int nameLen = readLeShort(locBuf, LOCNAM);
+	int extraLen = nameLen + readLeShort(locBuf, LOCEXT);
 	return entry.offset + LOCHDR + extraLen;
       }
   }

                 reply	other threads:[~2006-04-06 21:57 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=m3bqve2x12.fsf@localhost.localdomain \
    --to=tromey@redhat.com \
    --cc=java-patches@gcc.gnu.org \
    /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: link
Be 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).