Mailing List Archive

[issue5068] tarfile loops forever on broken input
New submission from Maciek Fijalkowski <fijal@genesilico.pl>:

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.

----------
components: Library (Lib)
messages: 80567
nosy: fijal
severity: normal
status: open
title: tarfile loops forever on broken input
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5068>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5068] tarfile loops forever on broken input [ In reply to ]
Changes by Lars Gustäbel <lars@gustaebel.de>:


----------
assignee: -> lars.gustaebel
nosy: +lars.gustaebel

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5068>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5068] tarfile loops forever on broken input [ In reply to ]
Lars Gustäbel <lars@gustaebel.de> added the comment:

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.

----------
versions: +Python 3.0, Python 3.1 -Python 2.4, Python 2.5

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5068>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com