From: Michihiro NAKAJIMA Date: Mon, 8 Aug 2011 08:10:56 +0000 (-0400) Subject: Fix a bug in lha reader. Correctly read remaining bits which are close to the end... X-Git-Tag: v3.0.0a~176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4f99f2fc1d5edb6ad6f64458cd637fb5619a39f;p=thirdparty%2Flibarchive.git Fix a bug in lha reader. Correctly read remaining bits which are close to the end of data. SVN-Revision: 3560 --- diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c index 35f2100a5..ec0395768 100644 --- a/libarchive/archive_read_support_format_lha.c +++ b/libarchive/archive_read_support_format_lha.c @@ -2054,7 +2054,8 @@ lzh_read_blocks(struct lzh_stream *strm, int last) if (ds->pt.len_avail == 0) { /* There is no bitlen. */ if (!lzh_br_read_ahead(strm, br, - ds->pt.len_bits)) { + ds->pt.len_bits) && + !lzh_br_has(br, ds->pt.len_bits)) { if (last) goto failed;/* Truncated data.*/ ds->state = ST_RD_PT_2;