]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix a bug in lha reader. Correctly read remaining bits which are close to the end...
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 8 Aug 2011 08:10:56 +0000 (04:10 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 8 Aug 2011 08:10:56 +0000 (04:10 -0400)
SVN-Revision: 3560

libarchive/archive_read_support_format_lha.c

index 35f2100a50f8bffae039fb4ccfd6c119cc93f56e..ec03957689b39cb1bef1c30a169480a9ec699af5 100644 (file)
@@ -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;