[New-bugs-announce] [issue42079] Why does tarfile.next swallow InvalidHeaderError

Jan Schatz report at bugs.python.org
Mon Oct 19 04:55:37 EDT 2020


New submission from Jan Schatz <jan.schatz at hms-networks.com>:

I have a tar gz archive that fails to be extracted via tarfile.extractall(). By adding some debug code I found that at some point InvalidHeaderError is raised inside tarfile.next(). But the function just swallows the exception, because the offset isn't 0 (see https://github.com/python/cpython/blob/5368c2b6e23660cbce7e38dc68f859c66ac349ee/Lib/tarfile.py#L2334). Why does the function behave like this? I would expect an except rather than silently stopping extraction if the archive is damaged.

----------
components: Library (Lib)
messages: 378934
nosy: jan.schatz
priority: normal
severity: normal
status: open
title: Why does tarfile.next swallow InvalidHeaderError
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42079>
_______________________________________


More information about the New-bugs-announce mailing list