From: Andres Mejia Date: Fri, 22 Jul 2011 02:58:05 +0000 (-0400) Subject: Catch error for all calls to read_next_symbol. X-Git-Tag: v3.0.0a~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8df70d403a3c9d3fa8a9a4514915e43c0ce58d;p=thirdparty%2Flibarchive.git Catch error for all calls to read_next_symbol. SVN-Revision: 3494 --- diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index 752410a52..55530e3ba 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -1533,8 +1533,7 @@ expand(struct archive_read *a, off_t end) return lzss_position(&rar->lzss); rar->bitoffset -= 8 * __archive_read_consume(a, (rar->bitoffset / 8)); - symbol = read_next_symbol(a, &rar->maincode); - if (symbol < 0) + if ((symbol = read_next_symbol(a, &rar->maincode)) < 0) return -1; rar->output_last_match = 0; @@ -1578,7 +1577,8 @@ expand(struct archive_read *a, off_t end) offsindex = symbol - 259; offs = rar->oldoffset[offsindex]; - lensymbol = read_next_symbol(a, &rar->lengthcode); + if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0) + return -1; len = lengthbases[lensymbol] + 2; if (lengthbits[lensymbol] > 0) len += read_bits_32(a, lengthbits[lensymbol]); @@ -1605,7 +1605,8 @@ expand(struct archive_read *a, off_t end) if(lengthbits[symbol-271] > 0) len += read_bits_32(a, lengthbits[symbol-271]); - offssymbol = read_next_symbol(a, &rar->offsetcode); + if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0) + return -1; offs = offsetbases[offssymbol]+1; if(offsetbits[offssymbol] > 0) { @@ -1621,7 +1622,9 @@ expand(struct archive_read *a, off_t end) } else { - lowoffsetsymbol = read_next_symbol(a, &rar->lowoffsetcode); + if ((lowoffsetsymbol = + read_next_symbol(a, &rar->lowoffsetcode)) < 0) + return -1; if(lowoffsetsymbol == 16) { rar->numlowoffsetrepeats = 15;