Fix #1279: correctly decrement remaining bytes while reading LIT directory chunks.

This commit is contained in:
Marshall T. Vandegrift 2008-11-17 23:02:28 -05:00
parent e6d872c317
commit 9cc7a6e0b3

View File

@ -557,7 +557,9 @@ class LitReader(object):
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)