]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Drop total_out tracking from read filters 3084/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 27 May 2026 20:37:24 +0000 (22:37 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 27 May 2026 20:37:24 +0000 (22:37 +0200)
The variable is never read and it only allows a very unlikely integer
overflow if more than INT64_MAX bytes are read.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_filter_gzip.c
libarchive/archive_read_support_filter_lzop.c
libarchive/archive_read_support_filter_xz.c
libarchive/archive_read_support_filter_zstd.c

index 726385e328a004078a717efe2e82a9fb5be1835a..0e21f28d2a1a571a5489bd2c36b689354f36ecd4 100644 (file)
@@ -56,7 +56,6 @@ struct private_data {
        char             in_stream;
        unsigned char   *out_block;
        size_t           out_block_size;
-       int64_t          total_out;
        unsigned long    crc;
        uint32_t         mtime;
        char            *name;
@@ -502,7 +501,6 @@ gzip_filter_read(struct archive_read_filter *self, const void **p)
 
        /* We've read as much as we can. */
        decompressed = state->stream.next_out - state->out_block;
-       state->total_out += decompressed;
        if (decompressed == 0)
                *p = NULL;
        else
index 12ed78c578cd0498e7b471faea36e12d37448e38..00b61cc8941e9ae593d26dfc5df35afab7fad49f 100644 (file)
@@ -71,7 +71,6 @@
 struct read_lzop {
        unsigned char   *out_block;
        size_t           out_block_size;
-       int64_t          total_out;
        int              flags;
        uint32_t         compressed_cksum;
        uint32_t         uncompressed_cksum;
@@ -434,7 +433,6 @@ lzop_filter_read(struct archive_read_filter *self, const void **p)
         */
        if (state->uncompressed_size == state->compressed_size) {
                *p = b;
-               state->total_out += state->compressed_size;
                state->unconsumed_bytes = state->compressed_size;
                return ((ssize_t)state->uncompressed_size);
        }
@@ -478,7 +476,6 @@ lzop_filter_read(struct archive_read_filter *self, const void **p)
 
        __archive_read_filter_consume(self->upstream, state->compressed_size);
        *p = state->out_block;
-       state->total_out += out_size;
        return ((ssize_t)out_size);
 }
 
index dcbf734ecacbb05bbf02ecc1d096f4e067b9d4a6..ef98af70a2c6177fb60969a273d997c28c2a2241 100644 (file)
@@ -54,7 +54,6 @@ struct private_data {
        lzma_stream      stream;
        unsigned char   *out_block;
        size_t           out_block_size;
-       int64_t          total_out;
        char             eof; /* True = found end of compressed data. */
        char             in_stream;
 
@@ -706,7 +705,6 @@ xz_filter_read(struct archive_read_filter *self, const void **p)
        }
 
        decompressed = state->stream.next_out - state->out_block;
-       state->total_out += decompressed;
        state->member_out += decompressed;
        if (decompressed == 0) {
                if (member_in != state->member_in &&
index da7c540dbcd99cc2d00828a07f5c9fae9af2759c..26662bf61ed5ca9978f959993927bd6e211312a5 100644 (file)
@@ -57,7 +57,6 @@ struct private_data {
        ZSTD_DStream    *dstream;
        unsigned char   *out_block;
        size_t           out_block_size;
-       int64_t          total_out;
        char             in_frame; /* True = in the middle of a zstd frame. */
        char             eof; /* True = found end of compressed data. */
 };
@@ -310,7 +309,6 @@ zstd_filter_read(struct archive_read_filter *self, const void **p)
        }
 
        decompressed = out.pos;
-       state->total_out += decompressed;
        if (decompressed == 0)
                *p = NULL;
        else