OSDN Git Service

PR libgcj/24461:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Mar 2006 20:21:58 +0000 (20:21 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Mar 2006 20:21:58 +0000 (20:21 +0000)
* java/util/zip/InflaterInputStream.java (fill): Throw exception
if stream is truncated.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111870 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/util/zip/InflaterInputStream.java

index 64df6b6..bde6b45 100644 (file)
@@ -1,5 +1,11 @@
 2006-03-09  Tom Tromey  <tromey@redhat.com>
 
+       PR libgcj/24461:
+       * java/util/zip/InflaterInputStream.java (fill): Throw exception
+       if stream is truncated.
+
+2006-03-09  Tom Tromey  <tromey@redhat.com>
+
        * win32.cc (_Jv_platform_nanotime): New function.
        * include/win32.h (_Jv_platform_nanotime): Declare.
        * posix.cc (_Jv_platform_nanotime): New function.
index 69b3ecd..11b06d2 100644 (file)
@@ -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 @@ public class InflaterInputStream extends FilterInputStream
     
     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);
   }
 
   /**