[Libreoffice-commits] mso-dumper.git: src/docrecord.py test/doc

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Aug 31 04:29:17 PDT 2013


 src/docrecord.py                |    9 ++++++++-
 test/doc/pass/gnome169822-1.doc |binary
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 3ecd48a450179a0f7335cdb11d3ec3b20c979ce9
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Aug 31 13:26:51 2013 +0200

    SttbfAssoc: don't try to read beyond the end of the stream
    
    Also, don't assert in SttbfRMark when it's probably cleared manually and
    add support for one more nFibNew magic number.

diff --git a/src/docrecord.py b/src/docrecord.py
index 16d99e0..3e23071 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2426,6 +2426,8 @@ class Dop(DOCDirStream):
             Dop97(self).dump()
         elif self.fib.nFibNew == 0x00d9:
             Dop2000(self).dump()
+        elif self.fib.nFibNew == 0x0101:
+            Dop2002(self).dump()
         elif self.fib.nFibNew == 0x0112:
             Dop2007(self).dump()
         else:
@@ -2574,6 +2576,10 @@ class SttbfAssoc(DOCDirStream):
                 meaning = indexMap[i]
             else:
                 meaning = "unknown"
+            if self.pos + 2 * cchData > self.size:
+                self.cData = 0
+                print '<info what="SttbfAssoc::dump() wanted to read beyond the end of the stream"/>'
+                break
             print '<cchData index="%s" meaning="%s" offset="%d" size="%d bytes">' % (hex(i), meaning, self.pos, cchData)
             print '<string value="%s"/>' % globals.encodeName(self.bytes[self.pos:self.pos+2*cchData].decode('utf-16'), lowOnly = True)
             self.pos += 2*cchData
@@ -2602,7 +2608,8 @@ class SttbfRMark(DOCDirStream):
             print '<string value="%s"/>' % globals.encodeName(self.bytes[self.pos:self.pos+2*cchData].decode('utf-16'), lowOnly = True)
             self.pos += 2*cchData
             print '</cchData>'
-        assert self.pos == self.mainStream.fcSttbfRMark + self.size
+        if self.cData != 0:
+            assert self.pos == self.mainStream.fcSttbfRMark + self.size
         print '</sttbfRMark>'
 
 class OfficeArtWordDrawing(DOCDirStream):
diff --git a/test/doc/pass/gnome169822-1.doc b/test/doc/pass/gnome169822-1.doc
new file mode 100644
index 0000000..7da17b8
Binary files /dev/null and b/test/doc/pass/gnome169822-1.doc differ


More information about the Libreoffice-commits mailing list