X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fxpress-decompress.c;h=b43e5273e75a006e99ba5b5df8b9fe2a2274faba;hp=123613d6921c3aac92c97b2ff749a381066e9703;hb=0ecb0529b5fcacc1abafa1f3f02a40c44783ada8;hpb=dd3f804966f577b104eda649f572e8e765edc7ef;ds=sidebyside diff --git a/src/xpress-decompress.c b/src/xpress-decompress.c index 123613d6..b43e5273 100644 --- a/src/xpress-decompress.c +++ b/src/xpress-decompress.c @@ -84,7 +84,7 @@ xpress_decode_window(struct input_bitstream *istream, const u16 *decode_table, u8 *window_end = &window[window_size]; unsigned sym; unsigned match_len; - unsigned offset_bsr; + unsigned offset_high_bit; unsigned match_offset; while (window_ptr != window_end) { @@ -99,12 +99,12 @@ xpress_decode_window(struct input_bitstream *istream, const u16 *decode_table, /* Match */ match_len = sym & 0xf; - offset_bsr = (sym >> 4) & 0xf; + offset_high_bit = (sym >> 4) & 0xf; bitstream_ensure_bits(istream, 16); - match_offset = (1 << offset_bsr) | - bitstream_pop_bits(istream, offset_bsr); + match_offset = (1 << offset_high_bit) | + bitstream_pop_bits(istream, offset_high_bit); if (match_len == 0xf) { match_len += bitstream_read_byte(istream); @@ -119,7 +119,8 @@ xpress_decode_window(struct input_bitstream *istream, const u16 *decode_table, if (unlikely(match_len > window_end - window_ptr)) return -1; - lz_copy(window_ptr, match_len, match_offset, window_end); + lz_copy(window_ptr, match_len, match_offset, window_end, + XPRESS_MIN_MATCH_LEN); window_ptr += match_len; }