[issue21872] LZMA library sometimes fails to decompress a file
Ma Lin
report at bugs.python.org
Sat Sep 14 00:31:45 EDT 2019
Ma Lin <malincns at 163.com> added the comment:
Some memos:
1, In liblzma, these missing bytes were copied inside `dict_repeat` function:
788 case SEQ_COPY:
789 // Repeat len bytes from distance of rep0.
790 if (unlikely(dict_repeat(&dict, rep0, &len))) {
See liblzma's source code (xz-5.2 branch):
https://git.tukaani.org/?p=xz.git;a=blob;f=src/liblzma/lzma/lzma_decoder.c
2, Above replies said xz's command line tools can extract the problematic files successfully.
This is because xz checks `if (avail_out == 0)` first, then checks `if (avail_in == 0)`
See `uncompress` function in this source code (xz-5.2 branch):
https://git.tukaani.org/?p=xz.git;a=blob;f=src/xzdec/xzdec.c;hb=refs/heads/v5.2
This check order just avoids the problem.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21872>
_______________________________________
More information about the Python-bugs-list
mailing list