py3: Type of exception raised has changed leading to corrupt trailing data becoming unrecoverable. Fixes #1994103 [[Bug] mobi convert TypeError: ord() expected a character, but string of length 0 found](https://bugs.launchpad.net/calibre/+bug/1994103)

This commit is contained in:
Kovid Goyal 2022-10-25 10:52:35 +05:30
parent 5be5d2fe09
commit c143ece70c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -782,7 +782,7 @@ class MobiReader:
if flags & 1: if flags & 1:
try: try:
num += sizeof_trailing_entry(data, size - num) num += sizeof_trailing_entry(data, size - num)
except IndexError: except (IndexError, TypeError):
self.warn_about_trailing_entry_corruption() self.warn_about_trailing_entry_corruption()
return 0 return 0
flags >>= 1 flags >>= 1