Bug description:
When a pax extended header carries a malformed GNU sparse number, tarfile parses it with a bare int() and lets the ValueError escape to the caller, unlike the GNU sparse 0.0 handler which reports such corruption as tarfile.InvalidHeaderError.
import tarfile
tarfile.TarInfo("x")._apply_pax_info(
{"GNU.sparse.size": "x"}, "utf-8", "strict") # ValueError
Reporting InvalidHeaderError makes the reader stop at the bad member like the 0.0 format does; a maintainer may prefer to raise instead, so the direction is open.
CPython versions tested on:
3.13, 3.14, 3.15
Operating systems tested on:
macOS
Linked PRs
Bug description:
When a pax extended header carries a malformed GNU sparse number,
tarfileparses it with a bareint()and lets theValueErrorescape to the caller, unlike the GNU sparse 0.0 handler which reports such corruption astarfile.InvalidHeaderError.Reporting
InvalidHeaderErrormakes the reader stop at the bad member like the 0.0 format does; a maintainer may prefer to raise instead, so the direction is open.CPython versions tested on:
3.13, 3.14, 3.15
Operating systems tested on:
macOS
Linked PRs