We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d29cc1e commit 124092fCopy full SHA for 124092f
src/isal/igzip.py
@@ -279,6 +279,12 @@ def _gzip_header_end(data: bytes) -> int:
279
pos = fcomment_end
280
if flags & FHCRC:
281
pos += 2
282
+ header_crc = int.from_bytes(data[pos: pos + 2], "little", signed=False)
283
+ # CRC is stored as a 16-bit integer by taking last bits of crc32.
284
+ crc = isal_zlib.crc32(data[:pos]) & 0xFFFF
285
+ if header_crc != crc:
286
+ raise BadGzipFile(f"Corrupted header. Checksums do not "
287
+ f"match: {crc} != {header_crc}")
288
return pos
289
290
0 commit comments