stangelandcl / LZ4Sharp

Unmaintained port of LZ4 Compression algorithm to C#
Other
61 stars 15 forks source link

System.OverflowException thrown while decompressing data #1

Closed yadolov closed 12 years ago

yadolov commented 12 years ago

LZ4Sharp source revision: a2de5bfac7ae51972d883a992662b4a8806f8722 (Feb 24, 2012) Build tools: Microsoft Visual Studio 2008, MinGW gcc 4.6.1 Code:

    byte[] src = new byte[50];
    ILZ4Compressor compressor = new LZ4Compressor32();
    byte[] dst = compressor.Compress(src);
    LZ4Decompressor32 decompressor = new LZ4Decompressor32();
    decompressor.Decompress(dst); // System.OverflowException here
stangelandcl commented 12 years ago

Thanks for the report. This is now fixed and I added this case as a test in the Program.cs of the LZ4Sharp Main project. By the way Decompressing to an unknown size will just loop until it can create a big enough array to hold the output. If you are doing this a lot and performance is an issue then you could try saving the uncompressed length and using DecompressKnownSize.