diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-09-14 15:00:08 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-09-14 15:00:40 +0200 |
commit | 0c1a03000e29219ce754df8bb99781d1564bf41a (patch) | |
tree | c84b9813929d68f67c0f441afa713be7a64319a9 | |
parent | 6de82e66a940e6438f1b567f56d720743f650fda (diff) |
swlaycache: trust the in-stream size, not the size of the stream
It's allowed to have extra data at the end of the stream, which is to be
ignored.
-rw-r--r-- | msodumper/swlaycacherecord.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/msodumper/swlaycacherecord.py b/msodumper/swlaycacherecord.py index dac75e4..fc03421 100644 --- a/msodumper/swlaycacherecord.py +++ b/msodumper/swlaycacherecord.py @@ -14,13 +14,16 @@ class SwLayCacheStream(BinaryStream): def dump(self): print('<stream type="SwLayCache" size="%d">' % self.size) - posOrig = self.pos header = Header(self) header.dump() - while posOrig + self.size > self.pos: - record = CacheRecord(self) - record.dump() + pos = self.pos + firstRecord = CacheRecord(self) + firstRecord.dump() + endPos = pos + firstRecord.nSize + + while endPos > self.pos: + CacheRecord(self).dump() print('</stream>') |