mirror of https://github.com/koreader/koreader
Validate DjVu magic string before opening.
While browsing libdjvu sources I remembered that I always validated DjVu magic string before passing the file to djvulibre. This is because forcing djvulibre errors on open is a bad idea --- it can lead to very strange side effects, such as refusing to open the next (valid!) DjVu file. So, I have now implemented the same in KPV --- check DjVu magic string before passing it to the proper DjVu :openDocument() method. I timed the difference between opening with and without validation and it was absolutely negligible (i.e. by far most of the time is spent in DjVu document decoding anyway).
parent
08ef1e3666
commit
64b6ef4afd
Loading…
Reference in New Issue