calibre misbehaves when bad jpeg in mobi file
calibre 2.13, 2.12 and…
Attached is an example of a .mobi file containing a corrupted Jpeg image that causes calibre to behave in a less-than-graceful manner.
File ShowJpegBug.mobi contains a corrupt .jpeg and very little else. I extracted the .jpeg from a real .mobi book that shows the same problems.
Problem 1. Drag the mobi into an open calibre library window. The worker process crashes with the message shown in AddMobiToLib.txt.
Problems 2 and 3. To demonstrate the next problems requires the mobi file to already be in the calibre library—in this case more difficult than usual!. To make it easier, I attach the equivalent epub file, ShowJpegBug.epub. I suggest drag the epub into the library then convert to mobi. Both these steps were uneventful for me.
Problem 2. Try to open the mobi in the built-in viewer and get the message "calibre-
Problem 3. Try to convert the mobi to azw3 (or probably anything else) and get the error shown in ConvMobiToAzw3.txt.
Conclusion. Bad images are always going to exist and it seems to me that calibre could handle them more gracefully. For example, accept them as is—as the internal viewer does when viewing the epub. Or display instead "Not a Valid Image" as the Files Browser does when you double-click the bad image.
As a new feature, might it be possible for the Check Book function (F7) to also check images? For this problem book it happily reports "No problems found", but there is a problem, just not in the html.
Attachments in zip file BadJpegInMobi.zip:
ShowJPegBug.mobi: The problem mobi file.
ShowJPegBug.epub: The non-problem epub file.
AddMobiToLib.txt: The error message when you try to add the mobi to the library.
ConvMobiToAzw3.txt: The error message when you try to convert the problem mobi.
Merry Christmas to Kovid and all on the calibre team.