[Bug #822668] tarfile raises an exception if the tarfile is gzipped and is too large; the gzip filesize should be written out mod 2**32. (Reported by Johan Fredrik Ohman)
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 9dd8601..26f9c7f 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -357,7 +357,7 @@
self.buf = ""
if self.type == "gz":
self.fileobj.write(struct.pack("<l", self.crc))
- self.fileobj.write(struct.pack("<L", self.pos))
+ self.fileobj.write(struct.pack("<L", self.pos & 0xffffFFFFL))
if not self._extfileobj:
self.fileobj.close()