Fix #1126 (.lit Convert Failure)

This commit is contained in:
Kovid Goyal 2008-10-04 13:31:11 -07:00
parent 817feebbc8
commit ab6a567334

View File

@ -543,7 +543,10 @@ class LitReader(object):
raise LitError('Directory entry had 64bit name length.') raise LitError('Directory entry had 64bit name length.')
if namelen > remaining - 3: if namelen > remaining - 3:
raise LitError('Read past end of directory chunk') raise LitError('Read past end of directory chunk')
name, chunk = chunk[:namelen].decode('utf-8'), chunk[namelen:] try:
name, chunk = chunk[:namelen].decode('utf-8'), chunk[namelen:]
except UnicodeDecodeError:
break
section, chunk, remaining = encint(chunk, remaining) section, chunk, remaining = encint(chunk, remaining)
offset, chunk, remaining = encint(chunk, remaining) offset, chunk, remaining = encint(chunk, remaining)
size, chunk, remaining = encint(chunk, remaining) size, chunk, remaining = encint(chunk, remaining)