Bug 8593

Summary: Error reading GZIPped files with BufferedReader
Product: gcc Reporter: wzab
Component: libgcjAssignee: Tom Tromey <tromey>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, java-prs
Priority: P3    
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: java_bug_files.zip

Description wzab 2002-11-15 10:56:00 UTC
When reading from the GZIPped file through the BufferedReader, an error occures at the end of file:
java.util.zip.ZipException: .zip archive ended prematurely    

The same code works correctly with the normal Java (1.1.8 and 1.3)

Release:
unknown

Environment:
Debian GNU/Linux testing, gcj-3.2, libgcj3.2.1

How-To-Repeat:
Run the make with attached makefile. Then run the produced ./ZipBug executable. The error messages produced in my system are contained in result_debug.txt and result.txt (when compiled without -g option) files
Comment 1 wzab 2002-11-15 10:56:00 UTC
Fix:
Unknown
Comment 2 Tom Tromey 2002-11-15 16:11:19 UTC
Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-Why: I'm handling this
Comment 3 Tom Tromey 2002-11-15 16:11:19 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: The bug is that when reading the footer we don't
    notice that there are still bytes available in
    the inflater.  I'm testing a patch.
Comment 4 Tom Tromey 2002-11-15 16:41:53 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: I've checked in the fix for this.
    Thanks.
Comment 5 Tom Tromey 2002-11-16 00:41:32 UTC
From: tromey@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libgcj/8593
Date: 16 Nov 2002 00:41:32 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	tromey@gcc.gnu.org	2002-11-15 16:41:32
 
 Modified files:
 	libjava        : ChangeLog 
 	libjava/java/util/zip: GZIPInputStream.java 
 
 Log message:
 	For PR libgcj/8593:
 	* java/util/zip/GZIPInputStream.java (read): Check file size.
 	Look in inflater for remaining input bytes.
 	(read4): Added buf and offset arguments.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.1533&r2=1.1534
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/zip/GZIPInputStream.java.diff?cvsroot=gcc&r1=1.5&r2=1.6