Skip to content

Commit

Permalink
Merge pull request #664 from onekey-sec/fix-cpio
Browse files Browse the repository at this point in the history
Handle UnicodeDecodeError on invalid CPIO entry
  • Loading branch information
qkaiser authored Oct 9, 2023
2 parents d302d0d + 91bf8a0 commit 8667d57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion unblob/handlers/archive/cpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ def parse(self): # noqa: C901
"CPIO entry filename is not null-byte terminated"
)

filename = snull(tmp_filename).decode("utf-8")
try:
filename = snull(tmp_filename).decode("utf-8")
except UnicodeDecodeError as e:
raise InvalidInputFormat from e

if filename == CPIO_TRAILER_NAME:
current_offset += self._pad_content(c_filesize)
Expand Down

0 comments on commit 8667d57

Please sign in to comment.