s = bytes('{"type": "BEGIN-FILE-LIST"}\n', 'UTF-8')
# calculate checksum and write into the stream
- crc = binascii.crc32(s)
+ crc = binascii.crc32(s) & 0xFFFFffff
index_fd.write(s)
# start creating the tarfile
s = bytes('{"type": "BEGIN-FILE-LIST"}\n', 'UTF-8')
# calculate checksum and write into the stream
- crc = binascii.crc32(s)
+ crc = binascii.crc32(s) & 0xFFFFffff
index_fd.write(s)
# start creating the tarfile
self.exception = zlib.error
else:
self._init_write_gz()
- self.crc = zlib.crc32(b"")
+ self.crc = zlib.crc32(b"") & 0xFFFFffff
elif comptype == "bz2":
try:
self.close(close_fileobj=False)
self.closed = False
self.concat_pos = 0
- self.crc = self.zlib.crc32(b"")
+ self.crc = self.zlib.crc32(b"") & 0xFFFFffff
self.cmp = self.zlib.compressobj(self.compresslevel,
self.zlib.DEFLATED,
-self.zlib.MAX_WBITS,
"""Write string s to the stream.
"""
if self.comptype == "gz":
- self.crc = self.zlib.crc32(s, self.crc)
+ self.crc = self.zlib.crc32(s, self.crc) & 0xFFFFffff
self.pos += len(s)
self.concat_pos += len(s)
if self.comptype != "tar":
raise ReadError("invalid compressed data")
if self.comptype == "gz" and hasattr(self, "crc"):
- self.crc = self.zlib.crc32(buf, self.crc)
+ self.crc = self.zlib.crc32(buf, self.crc) & 0xFFFFffff
if self.concat_stream and len(self.cmp.unused_data) != 0:
self.buf = self.cmp.unused_data + self.buf
self.close(close_fileobj=False)
except:
# happens at the end of the file
pass
- self.crc = self.zlib.crc32(b"")
+ self.crc = self.zlib.crc32(b"") & 0xFFFFffff
self.closed = False
t.append(buf)
c += len(buf)
if l == b'':
break
if b'BEGIN-FILE-LIST' in l:
- crc = binascii.crc32(l)
+ crc = binascii.crc32(l) & 0xFFFFffff
began_list = True
elif b'END-FILE-LIST' in l:
crc = binascii.crc32(l, crc) & 0xffffffff