From: Michihiro NAKAJIMA Date: Wed, 3 Aug 2011 10:28:52 +0000 (-0400) Subject: When Skipping data in a store mode, use rar->bytes_remaining instead of rar->packed_size. X-Git-Tag: v3.0.0a~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fafd6b0e8001a4d1539934e85a7e69f2cbfceb20;p=thirdparty%2Flibarchive.git When Skipping data in a store mode, use rar->bytes_remaining instead of rar->packed_size. a use of packed_size in that case will not work after archive_read_format_rar_read_data has been called. SVN-Revision: 3528 --- diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index ad97c8c09..4e46a0fdd 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -566,9 +566,11 @@ archive_read_format_rar_read_data_skip(struct archive_read *a) case COMPRESS_METHOD_GOOD: case COMPRESS_METHOD_BEST: default: - bytes_skipped = __archive_read_consume(a, rar->packed_size); - if (bytes_skipped < 0) - return (ARCHIVE_FATAL); + if (rar->bytes_remaining > 0) { + bytes_skipped = __archive_read_consume(a, rar->bytes_remaining); + if (bytes_skipped < 0) + return (ARCHIVE_FATAL); + } } return (ARCHIVE_OK); }