pradeep250677 / lz4

Automatically exported from code.google.com/p/lz4
0 stars 0 forks source link

Decompress unknown output size doesn't correctly indicate that decompressing did not complete successfully. #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Read attached file as byte array
2. Compress it
3. Decompress Unknown output size

What is the expected output? What do you see instead?
Decompressed output should match input.
The decompressed array is too short.

What version of the product are you using? On what operating system?
I am actually using the LZ4Sharp port but changing line 850-ish from 
if (op == oend) break;    // Check EOF (should never happen, since last 5 bytes 
are supposed to be literals)
to 
if (op == oend) goto _output_error;
fixes the problem because then whatever is looping and increasing the output 
array size knows to run it again with a bigger size. The comment also indicates 
this is an error condition. 

Please provide any additional information below.
The data file is attached.

The error may only show up when increasing the output array in certain size 
increments. I was using input array * 4 to start and multiplying by 4 each time 
through the loop.

Original issue reported on code.google.com by Clayton....@gmail.com on 2 Oct 2012 at 8:39

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks Clayton. Clearly described. I'll look into it.

Original comment by yann.col...@gmail.com on 2 Oct 2012 at 9:40

GoogleCodeExporter commented 8 years ago
Corrected into r78.
Thanks to Clayton Stangeland and Maciej Adamczyk.

Original comment by yann.col...@gmail.com on 16 Oct 2012 at 9:55