]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Fix SIGSEGV in compress filter when appended before open
authorFrançois Degros <fdegros@chromium.org>
Fri, 24 Apr 2026 07:09:13 +0000 (17:09 +1000)
committerFrançois Degros <fdegros@chromium.org>
Fri, 24 Apr 2026 07:24:02 +0000 (17:24 +1000)
commit3d4871e4d217b4eb395c00faf38cedfaa85fe8a3
tree1c694d076cb0ff1ed496510f8647884836821726
parentd8ca779e4d48d457a79fb956b0d8d38c27e0a67e
Fix SIGSEGV in compress filter when appended before open

Calling archive_read_append_filter(a, ARCHIVE_FILTER_COMPRESS) would
previously trigger a crash because compress_bidder_init() attempted to
read header bits from the upstream filter immediately. If the archive
was not yet opened (common when setting up filters), the upstream filter
state was not ready for reading.

This commit defers the header reading and decompressor initialization
until the first read operation (lazy initialization), consistent with
other filter implementations in libarchive.

Added test_read_append_compress_filter.

Bug: https://github.com/libarchive/libarchive/issues/2514
Test: ./libarchive_test test_read_append_compress_filter
libarchive/archive_read_support_filter_compress.c
libarchive/test/test_read_set_format.c