[Libreoffice-commits] mso-dumper.git: msodumper/swlaycacherecord.py

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 13:01:36 UTC 2018


 msodumper/swlaycacherecord.py |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 0c1a03000e29219ce754df8bb99781d1564bf41a
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Sep 14 15:00:08 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Sep 14 15:00:40 2018 +0200

    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.

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>')
 
 


More information about the Libreoffice-commits mailing list