]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix a bug in lha read format.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 3 Jul 2014 11:26:43 +0000 (20:26 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Thu, 3 Jul 2014 11:26:43 +0000 (20:26 +0900)
The bug was it could not correctly extract the compressed data
which had just one repated pattern.

libarchive/archive_read_support_format_lha.c

index 3c565c0015bdb8f41d35b578dc878970929d1f9d..66fd927cc3bd259192549e6a65ff7336fe05c2cf 100644 (file)
@@ -2743,7 +2743,7 @@ lzh_decode_huffman(struct huffman *hf, unsigned rbits)
         * If it fails, search a huffman tree for.
         */
        c = hf->tbl[rbits >> hf->shift_bits];
-       if (c < hf->len_avail)
+       if (c < hf->len_avail || hf->len_avail == 0)
                return (c);
        /* This bit pattern needs to be found out at a huffman tree. */
        return (lzh_decode_huffman_tree(hf, rbits, c));