PRJosh / lz4

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

decodeLZ4S: decodedBytes usage? #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
decodedBytes seems misused in a scenario like this:

Block 1 is compressed

decodedBytes = decompressionFunction(in_buff, out_start, blockSize, 
maxBlockSize);
...
out_start += decodedBytes; // ok

Block 2 is uncompressed
...
out_start += decodedBytes; // old value

yves

Original issue reported on code.google.com by ybast...@gmail.com on 11 Jul 2013 at 12:45

GoogleCodeExporter commented 9 years ago
Thanks for reporting Yves.

Your report is correct, although the problem never happens in practice.
Reason is : currently, the algorithm always this branch :
if (blockSize >= prefix64k)
because this condition is always true.

Nonetheless, it will be corrected in next release.
After all, this condition may no longer hold true in the future.

Regards

Original comment by yann.col...@gmail.com on 11 Jul 2013 at 1:01

GoogleCodeExporter commented 9 years ago

Original comment by yann.col...@gmail.com on 11 Jul 2013 at 1:02

GoogleCodeExporter commented 9 years ago
The proposed version in attached file should correct the issue reported here.
Note that it is not representative of the next release, which is a WIP, and 
will feature additional changes.

Original comment by yann.col...@gmail.com on 11 Jul 2013 at 1:34

Attachments:

GoogleCodeExporter commented 9 years ago
Corrected into r99

Original comment by yann.col...@gmail.com on 27 Jul 2013 at 11:29