liblzma: Fix a compression-ratio regression in LZMA1/2 in fast mode.

The bug was added in the commit
f48fce093b and thus
affected 5.1.4beta and 5.2.0. Luckily the bug cannot
cause data corruption or other nasty things.
This commit is contained in:
Lasse Collin 2015-02-21 23:40:26 +02:00
parent ae984e31c1
commit 117d962685
1 changed files with 1 additions and 1 deletions

View File

@ -152,7 +152,7 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf,
// the old buf pointer instead of recalculating it with mf_ptr(). // the old buf pointer instead of recalculating it with mf_ptr().
++buf; ++buf;
const uint32_t limit = len_main - 1; const uint32_t limit = my_max(2, len_main - 1);
for (uint32_t i = 0; i < REPS; ++i) { for (uint32_t i = 0; i < REPS; ++i) {
if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) { if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) {