public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [4.1] Patch: FYI: ZipFile fixlet
@ 2006-04-06 21:57 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2006-04-06 21:57 UTC (permalink / raw)
  To: Java Patch List

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;
       }
   }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-06 21:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-06 21:57 [4.1] Patch: FYI: ZipFile fixlet Tom Tromey

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).