summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-09-14 15:00:08 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-09-14 15:00:40 +0200
commit0c1a03000e29219ce754df8bb99781d1564bf41a (patch)
treec84b9813929d68f67c0f441afa713be7a64319a9
parent6de82e66a940e6438f1b567f56d720743f650fda (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.py11
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>')