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.

classification
Title: tarfile loops forever on broken input
Type: Stage:
Components: Library (Lib) Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lars.gustaebel Nosy List: fijal, lars.gustaebel
Priority: normal Keywords:

Created on 2009-01-26 11:08 by fijal, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg80567 - (view) Author: Maciek Fijalkowski (fijal) Date: 2009-01-26 11:08
I have troubles actually finding such a file, but I encountered it at
least once (file is gone by now though). The lines in question are for
bz2 compression:

in _BZ2Proxy.read:

            try:
                raw = self.fileobj.read(self.blocksize)
                data = self.bz2obj.decompress(raw)
                b.append(data)
            except EOFError:
                break

if it ever goes here (after finishing reading header) and data is
truncated, fileobj.read() will return 0 and data will be '' and
so on forever.
msg80587 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2009-01-26 19:25
Thanks for the report. The problem is in fact easy to reproduce.
_BZ2Proxy hangs if it is passed a file object with either no data or
with a partial bzipped file. For example try:

tarfile.open(mode="r:bz2", fileobj=StringIO.StringIO())

I will create a decent fix for that problem, but not before next week. I
am too busy doing other important stuff ATM.
msg83982 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2009-03-22 20:53
I just checked in a fix for the problem, r70523-70527. Thank you very
much for your report.
History
Date User Action Args
2022-04-11 14:56:44adminsetgithub: 49318
2009-03-22 20:53:50lars.gustaebelsetstatus: open -> closed
resolution: fixed
messages: + msg83982

versions: + Python 2.5
2009-01-26 19:25:41lars.gustaebelsetmessages: + msg80587
versions: + Python 3.0, Python 3.1, - Python 2.5, Python 2.4
2009-01-26 11:51:27lars.gustaebelsetassignee: lars.gustaebel
nosy: + lars.gustaebel
2009-01-26 11:08:30fijalcreate