]> git.ipfire.org Git - thirdparty/xz.git/commit
liblzma: Add optional autodetection of LZMA end marker.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 13 Jul 2022 19:24:07 +0000 (22:24 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Sun, 24 Jul 2022 08:36:56 +0000 (11:36 +0300)
commitff54b557fe3b06b59a24e4028c1464c35dd5b142
tree47c227ef6dd8b42204ee119326efbc34a9b518d1
parentbb795fe835cf2b3ae7ed68b155784fbfc14e2faf
liblzma: Add optional autodetection of LZMA end marker.

Turns out that this is needed for .lzma files as the spec in
LZMA SDK says that end marker may be present even if the size
is stored in the header. Such files are rare but exist in the
real world. The code in liblzma is so old that the spec didn't
exist in LZMA SDK back then and I had understood that such
files weren't possible (the lzma tool in LZMA SDK didn't
create such files).

This modifies the internal API so that LZMA decoder can be told
if EOPM is allowed even when the uncompressed size is known.
It's allowed with .lzma and not with other uses.

Thanks to Karl Beldan for reporting the problem.
doc/lzma-file-format.txt
src/liblzma/common/alone_decoder.c
src/liblzma/lz/lz_decoder.c
src/liblzma/lz/lz_decoder.h
src/liblzma/lzma/lzma2_decoder.c
src/liblzma/lzma/lzma_decoder.c