New submission from Benjamin Fogle: To reproduce:
>>> import lzma >>> c = lzma.LZMACompressor() >>> c.compress(b'') b'\xfd7zXZ\x00\x00\x04\xe6\xd6\xb4F' >>> c.compress(b'') b'' >>> c.compress(b'') Traceback (most recent call last): File "<stdin>", line 1, in <module> _lzma.LZMAError: Insufficient buffer space >>> d = lzma.LZMADecompressor() >>> d.decompress(b'') b'' >>> d.decompress(b'') Traceback (most recent call last): File "<stdin>", line 1, in <module> _lzma.LZMAError: Insufficient buffer space This can occur anytime during compression/decompression when an empty string is passed twice in a row. The problem is that that liblzma interprets a call to lzma_code() with avail_in == 0 as a buffer full condition. The second time in a row it encounters this, it returns LZMA_BUF_ERROR as per documentation. The attached patch prevents this condition from occurring. ---------- components: Extension Modules files: lzma.patch keywords: patch messages: 270451 nosy: benfogle priority: normal severity: normal status: open title: LZMACompressor and LZMADecompressor raise exceptions if given empty strings twice type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file43727/lzma.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27517> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com