From c143ece70c7b7504b3635ec943c649cb78613fa7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 25 Oct 2022 10:52:35 +0530 Subject: [PATCH] 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) --- src/calibre/ebooks/mobi/reader/mobi6.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index d817d58b21..407e6e1c12 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -782,7 +782,7 @@ class MobiReader: if flags & 1: try: num += sizeof_trailing_entry(data, size - num) - except IndexError: + except (IndexError, TypeError): self.warn_about_trailing_entry_corruption() return 0 flags >>= 1