This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author benfogle
Recipients benfogle
Date 2016-07-15.01:03:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468544610.85.0.0793383244022.issue27517@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-07-15 01:03:30benfoglesetrecipients: + benfogle
2016-07-15 01:03:30benfoglesetmessageid: <1468544610.85.0.0793383244022.issue27517@psf.upfronthosting.co.za>
2016-07-15 01:03:30benfoglelinkissue27517 messages
2016-07-15 01:03:29benfoglecreate