diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-10 13:40:07 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-10 13:40:12 +0200 |
commit | f6d4a8588d9eba8139ee399cd53fbdc0b1a62cf7 (patch) | |
tree | c2958acbc493a09f753d51d5f3f06eed44bd6d32 | |
parent | 771b435fb0941d21c58cafd78d2c90f905ed29f6 (diff) |
msodraw: avoid dumping too large files in BlipEMF::dumpXml()
I'm not sure what would be a reasonable limit, I just came up with this
one to avoid hang on a document I wanted to inspect.
-rw-r--r-- | msodumper/msodraw.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/msodumper/msodraw.py b/msodumper/msodraw.py index cfaf245..1e9c58f 100644 --- a/msodumper/msodraw.py +++ b/msodumper/msodraw.py @@ -349,7 +349,11 @@ class BlipEMF: recHdl.appendLine('<rgbUid2 value="%s"/>' % hexdump(self.rgbUid2)) self.metafileHeader.dumpXml(recHdl, model, rh) if self.metafileHeader.compression == 0x00: - recHdl.appendLine('<BLIPFileData value="%s"/>' % inflate(self.BLIPFileData)) + # No idea if this is a reasonable limit. + if len(self.BLIPFileData) > pow(2, 18): + recHdl.appendLine('<info what="BLIPFileData size is too large (%s bytes), skipping"/>' % len(self.BLIPFileData)) + else: + recHdl.appendLine('<BLIPFileData value="%s"/>' % inflate(self.BLIPFileData)) else: recHdl.appendLine('<todo what="BlipEMF::dumpXml(): unexpected metafileHeader.compression == %s"/>' % hex(self.metafileHeader.compression)) recHdl.appendLine('</blipEmf>') |