]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Skip over LZ4/zstd skippable frames when detecting data format 2771/head
authorMostyn Bramley-Moore <mostyn@antipode.se>
Sat, 1 Nov 2025 21:42:30 +0000 (22:42 +0100)
committerMostyn Bramley-Moore <mostyn@antipode.se>
Sat, 1 Nov 2025 21:43:38 +0000 (22:43 +0100)
commit1435c4b20cb7d2151956689629c20f83f32162c4
treee0f031e77df513131c7db7bc762625ddd2ed0580
parent989a3037936686d5c529f68e8a962260fde75181
Skip over LZ4/zstd skippable frames when detecting data format

Since LZ4 and zstd share the same format for skippable frames, we need
to skip over these frames when trying to detect the format of compressed
data. Let's read up to something like 64kb of data when performing this
scanning.

Note that the LZ4 specification advises against starting with a skippable
frame, but doesn't forbid it:
> For the purpose of facilitating identification, it is discouraged to
> start a flow of concatenated frames with a skippable frame. If there
> is a need to start such a flow with some user data encapsulated into
> a skippable frame, it's recommended to start with a zero-byte LZ4
> frame followed by a skippable frame. This will make it easier for
> file type identifiers.

Resolves #2692.
libarchive/archive_read_support_filter_lz4.c
libarchive/archive_read_support_filter_zstd.c