This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: fix PR 24461


I'm checking this in on the trunk and the 4.1 branch.

This fixes PR 24461 by merging in a bit of code from Classpath.

I'll put the test case from the PR into Mauve a bit later.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	PR libgcj/24461:
	* java/util/zip/InflaterInputStream.java (fill): Throw exception
	if stream is truncated.

Index: java/util/zip/InflaterInputStream.java
===================================================================
--- java/util/zip/InflaterInputStream.java	(revision 111868)
+++ java/util/zip/InflaterInputStream.java	(working copy)
@@ -1,5 +1,5 @@
 /* InflaterInputStream.java - Input stream filter for decompressing
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -153,8 +153,10 @@
     
     len = in.read(buf, 0, buf.length);
 
-    if (len >= 0)
-      inf.setInput(buf, 0, len);
+    if (len < 0)
+      throw new ZipException("Deflated stream ends early.");
+    
+    inf.setInput(buf, 0, len);
   }
 
   /**


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]