Has anyone experienced the following error while using the .NET Deflate Stream?
System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.IO.Compression.HuffmanTree.CreateTable() at System.IO.Compression.Inflater.DecodeDynamicBlockHeader() at System.IO.Compression.Inflater.Decode() at System.IO.Compression.Inflater.Inflate(Byte[] bytes, Int32 offset, Int32 length) at System.IO.Compression.DeflateStream.Read(Byte[] array, Int32 offset, Int32 count)
This error occurs when decompressing a deflate stream read from disk. I am using simple indexed files with many small deflate encoded chunks in them. It is a very rare error, as only one compressed item out of several hundred thousand (or million) experience this error.
It seems that the HuffmanTree.CreateTable method exceptions and the routine attempts to fill the array beyond its limits.
I have tried allocating an array that is twice the size of the original for decompression and it still throws the error.
The decoded data seems to be intact, however, the routine keeps trying to decode and overflows the buffer.
I suppose I could just try/catch and detect if this error occurs and then attempt to deal with it.
Any insight into the problem would be appreciated.
(I have tried DotNetZip which is causing different issues in the 64 bit environment I am working in.)