Skip to content

Commit

Permalink
Merge pull request #674 from onekey-sec/cpio-checksum-fix
Browse files Browse the repository at this point in the history
fix(cpio): fixed checksum calculation to handle 4 byte overflows
  • Loading branch information
qkaiser authored Nov 11, 2023
2 parents c040df9 + f1f18d9 commit 81929c2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions unblob/handlers/archive/cpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ def valid_checksum(self, header, start_offset: int) -> bool:

for chunk in iterate_file(self.file, start_offset, file_size):
calculated_checksum += sum(bytearray(chunk))

return header_checksum == calculated_checksum
return header_checksum == calculated_checksum & 0xFF_FF_FF_FF


class _CPIOExtractorBase(Extractor):
Expand Down

0 comments on commit 81929c2

Please sign in to comment.