From: Michihiro NAKAJIMA Date: Thu, 3 Jul 2014 11:26:43 +0000 (+0900) Subject: Fix a bug in lha read format. X-Git-Tag: v3.1.900a~267 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31272acaf4e37c6fdfbb587b69063520f661487c;p=thirdparty%2Flibarchive.git Fix a bug in lha read format. The bug was it could not correctly extract the compressed data which had just one repated pattern. --- diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c index 3c565c001..66fd927cc 100644 --- a/libarchive/archive_read_support_format_lha.c +++ b/libarchive/archive_read_support_format_lha.c @@ -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));