Skip to content

Commit 7771636

Browse files
committed
BUG: Snappy checksum check
1 parent 4cac691 commit 7771636

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyiceberg/avro/codecs/snappy_codec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def compress(data: bytes) -> tuple[bytes, int]:
5151
@staticmethod
5252
def decompress(data: bytes) -> bytes:
5353
# Compressed data includes a 4-byte CRC32 checksum
54-
data = data[0:-4]
54+
checksum = data[-4:] # store checksum before truncating data
55+
data = data[0:-4] # remove checksum from the data
5556
uncompressed = snappy.decompress(data)
56-
checksum = data[-4:]
5757
SnappyCodec._check_crc32(uncompressed, checksum)
5858
return uncompressed
5959

0 commit comments

Comments
 (0)