From: Eric Biggers Date: Sun, 14 Sep 2014 17:27:16 +0000 (-0500) Subject: lzx-compress.c: Fix for lazy parsing and multiple blocks X-Git-Tag: v1.7.2~15 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=82b8e9da4931a731976c3998f2464d4e690502e8 lzx-compress.c: Fix for lazy parsing and multiple blocks --- diff --git a/src/lzx-compress.c b/src/lzx-compress.c index a9745b62..c7ff96f5 100644 --- a/src/lzx-compress.c +++ b/src/lzx-compress.c @@ -1788,6 +1788,8 @@ lzx_choose_lazy_items_for_block(struct lzx_compressor *c, * length 3 match. Output the previous match if there * is one; otherwise output a literal. */ + no_match_found: + if (prev_len) { skip_len = prev_len - 2; goto output_prev_match; @@ -1825,11 +1827,8 @@ lzx_choose_lazy_items_for_block(struct lzx_compressor *c, if (unlikely(cur_len > block_end - (window_ptr - 1))) { /* Nearing end of block. */ cur_len = block_end - (window_ptr - 1); - if (cur_len < 3) { - lzx_declare_literal(c, *(window_ptr - 1), &next_chosen_item); - prev_len = 0; - continue; - } + if (cur_len < 3) + goto no_match_found; } if (prev_len == 0 || cur_score > prev_score) {