Skip to content

Commit 18251f5

Browse files
authored
gh-137396: Guard against negative offset in tarfile (GH-XXXXX)
1 parent 04c7f36 commit 18251f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/tarfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ def _proc_sparse(self, tarfile):
14371437
numbytes = nti(buf[pos + 12:pos + 24])
14381438
except ValueError:
14391439
break
1440-
if offset and numbytes:
1440+
if offset >= 0 and numbytes >= 0:
14411441
structs.append((offset, numbytes))
14421442
pos += 24
14431443
isextended = bool(buf[504])

0 commit comments

Comments
 (0)