Inflater.c bug?

pra at mint.se pra at mint.se
Wed Jan 27 09:49:33 PST 1999


On 26 Jan, Archie Cobbs wrote:
> pra at mint.se writes:
>> I have problems using GZIPInputStream. I always get an error message
>> like this:
>> java.lang.Error: oversubscribed dynamic bit lengths tree
>>         at java/util/zip/InflaterInputStream.read(72)
>>         at java/util/zip/GZIPInputStream.read(78)
>>         at java/io/InputStreamReader.read(53)
>>         at java/io/BufferedReader.refillBuffer(164)
>>         at java/io/BufferedReader.readLine(130)
>>         at TestIo.main(line unknown, pc 0x83e812d)
>> 
>> I have tracked the error down to inftrees.c in zlib but can't find any
>> way of improving the code. Any one having any experinec on this.
>> 
>> I have tested it with
>> kaffe 1.0b2 and kaffe 1.0b3 and the latest snapshot. It has also been
>> tested both agains zlib 1.0.4 and 1.1.2.
>> 
>> This is sad becaus I get a 7 timespeed improvement in io with kaffe
>> compared to the blackdown JDK, and I need this improvement for GZ-files
>> to.
>> 
>> Here is the codefragment creating the input-stream, from wich I 
>> read with readLine():
>> 
>>   protected Reader makeReader(String file) throws java.io.IOException {
>>     Reader reader;
>>     // Create an input source for the lexer
>>     FileInputStream fileStream = new java.io.FileInputStream( file );
>>     if ( se.dn.annons.util.FileUtils.isGZ( file) ) {
>>       GZIPInputStream inStream = new GZIPInputStream( fileStream );
>>       reader = new BufferedReader( new InputStreamReader( inStream ) );
>>     } else {
>>       reader = new BufferedReader( new InputStreamReader( fileStream));
>>     }
>>     return reader;
>>   }
> 
> Does this happen with any input file or just some?

Hi, All files I had tested it on failed in the same way. But now I
extended my tests and strange things started happen:

Lets take the source file for the appended program and do some tests:

tar -cvzf TestIo.java.tar.gz TestIo.java 
WORKS

gzip TestIo.java (with gzip 1.2.4)
I now get:
java.lang.Error: invalid block type
        at java/util/zip/InflaterInputStream.read(72)
        at java/util/zip/GZIPInputStream.read(78)
        at java/io/InputStreamReader.read(53)
        at java/io/BufferedReader.refillBuffer(164)
        at java/io/BufferedReader.readLine(130)
        at TestIo.main(55)

minigzip TestIo.java (from zlib-1.1.2)
WORKS

However
gzip TestIo.java (with gzip 1.2.4)
minigzip -d TestIo.java.gz (from zlib-1.1.2)
WORKS

I dont know if this is of any help:
gzip -vl TestIo.java.gz (compressed with gzip):
method  crc     date  time  compressed  uncompr. ratio uncompressed_name
defla caf3be8a Jan 27 10:43       643      1419  56.8% TestIo.java

gzip -vl TestIo.gzjava (compresed with minigzip)
method  crc     date  time  compressed  uncompr. ratio uncompressed_name
defla caf3be8a Jan 27 10:46       631      1419  56.8% TestIo.java

With the same reported comression rate gzip produces a file containg 12
additional bytes.




> If the latter, please email a (small) file that triggers
> the bug, plus a complete test Java file, if you can..
> 
> -Archie

Here we have a small app:

import java.io.*;

public class TestIo {
  
  public TestIo() {
    
  }

  protected Reader makeReader(String file) throws java.io.IOException {
    Reader reader;
 
    FileInputStream fileStream = new java.io.FileInputStream( file );
    if ( isGZ( file) ) {
      GZIPInputStream inStream = new GZIPInputStream( fileStream );
      reader = new BufferedReader( new InputStreamReader( inStream ) );
    } else {
      reader = new BufferedReader( new InputStreamReader( fileStream));
    }
    return reader;
  }
  
  protected static boolean isGZ(String name) {
    String ucName = name.toUpperCase(); 
    if ( ucName.endsWith(".GZ") ){
      return true;
    } else {
      return false;
    }
  }
  
  public static void main(String[] args) {
    TestIo io = new TestIo();

    BufferedReader r;
    try {
      r = (BufferedReader)io.makeReader( args[0] );
      
      String line;
      do {
	line = r.readLine();
      } while(line != null);
      
    }
    catch (Exception e) {
      System.out.println(e);
    }
  }
    
} // TestIo

--Peter
-- 
-- 
--------------------------------------------------------
Peter Antman		AB Dagens Nyheter
System Developer	Gjörwellsgatan 30, 105 15 Sockholm
Email: pra at mint.se	WWW: http://www.dn.se/
Phone: 08-738 1338	Mobile: 070-675 3942 
--------------------------------------------------------



More information about the kaffe mailing list