mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-01 16:23:08 +02:00
Fix #1279: correctly decrement remaining bytes while reading LIT directory chunks.
This commit is contained in:
commit
e349723e68
1 changed files with 3 additions and 1 deletions
|
|
@ -557,7 +557,9 @@ def _read_directory(self, piece):
|
|||
if namelen > remaining - 3:
|
||||
raise LitError('Read past end of directory chunk')
|
||||
try:
|
||||
name, chunk = chunk[:namelen].decode('utf-8'), chunk[namelen:]
|
||||
name = chunk[:namelen].decode('utf-8')
|
||||
chunk = chunk[namelen:]
|
||||
remaining -= namelen
|
||||
except UnicodeDecodeError:
|
||||
break
|
||||
section, chunk, remaining = encint(chunk, remaining)
|
||||
|
|
|
|||
Loading…
Reference in a new issue