i use HTTPRangeStream and ZipFile to decompress an
encrypted comes from server over http
some files are decompressed properly but on some files it throw the following exception:
"Bad state (invalid block type)" and sometime it through "Bad state (oversubscribed dynamic bit lengths tree)"
when i decompress the file direct from local machine "not over http" its decompress properly.
so the problem just when i use the HTTPRangeStream.
please any help
Feb 14, 2011 at 6:24 PM
Well, let's see, that HttpRangeStream thing - I think that might be some sample code that I published a while ago, is that right? I'm pretty sure it's not part of DotNetZip, and it's not something I can support.
But I can offer some ideas. First, I have no idea what the problem might be. The errors that you see suggest that there is corrupted data in your encrypted stream. This may happen if HttpRangeStream is reading the wrong data, or is reading
data out of order, and so on.
I have two suggestions for what I would do to diagnose and solve this problem. #1, wrap the HttpRangeStream in a BufferedStream so that it buffers as it reads; this may solve the problem immediately, with no diagnostic effort. If that doesn't
work, then #2, I would introduce some tracing or diagnostics directly into HttpRangeStream to see what reads are occurring, and what it is returning. Then compare that to a stream read from a regular filesystem file. (You may find it helpful to create
a new stream type, like TracedStream, to wrap around the HttpRangeStream or FileStream. The TracedStream would collect diagnostics on each Read() call, and then pass through the read to the wrapped stream.)
May 13, 2014 at 1:12 PM
Edited May 13, 2014 at 1:13 PM
I get this error when trying to open an AES encypted ZIP file produced by PdfTron's PDFNet library.
When opening the ZIP with Winrar, the files are empty and it doesn't ask for any password.
Here is the call stack:
[ZlibException: Bad state (oversubscribed dynamic bit lengths tree)]
Ionic.Zlib.InflateManager.Inflate(FlushType flush) +1576
Ionic.Zlib.ZlibCodec.Inflate(FlushType flush) +18
Ionic.Zlib.ZlibBaseStream.Read(Byte buffer, Int32 offset, Int32 count) +341
Ionic.Zlib.DeflateStream.Read(Byte buffer, Int32 offset, Int32 count) +26
Ionic.Crc.CrcCalculatorStream.Read(Byte buffer, Int32 offset, Int32 count) +109
Ionic.Zip.ZipEntry.ExtractOne(Stream output) +294
Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password) +1012
Ionic.Zip.ZipEntry.Extract(Stream stream) +10
Great work with this library by the way! :)
I love it! :)