aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2015-02-21 23:40:26 +0200
committerLasse Collin <lasse.collin@tukaani.org>2015-02-21 23:40:26 +0200
commit117d962685c72682c63edc9bb765367189800202 (patch)
treed34a3c2b7cc93f5d8367cbc13a0f4409d4de8d07 /src
parentxz: Fix the fcntl() usage when creating a pipe for the self-pipe trick. (diff)
downloadxz-117d962685c72682c63edc9bb765367189800202.tar.xz
liblzma: Fix a compression-ratio regression in LZMA1/2 in fast mode.
The bug was added in the commit f48fce093b07aeda95c18850f5e086d9f2383380 and thus affected 5.1.4beta and 5.2.0. Luckily the bug cannot cause data corruption or other nasty things.
Diffstat (limited to '')
-rw-r--r--src/liblzma/lzma/lzma_encoder_optimum_fast.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/liblzma/lzma/lzma_encoder_optimum_fast.c b/src/liblzma/lzma/lzma_encoder_optimum_fast.c
index 8922cbd9..9b30347c 100644
--- a/src/liblzma/lzma/lzma_encoder_optimum_fast.c
+++ b/src/liblzma/lzma/lzma_encoder_optimum_fast.c
@@ -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().
++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) {
if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) {