summaryrefslogtreecommitdiff
path: root/sw/source/ui/dochdl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-03-04 20:41:02 +0100
committerJan Holesovsky <kendy@collabora.com>2014-03-04 23:05:11 +0100
commitbe4f7ea3f6c8bddba3ca1ae3d9d9e67449bbc3cb (patch)
tree6ef1cb20dff6cb70cd2adc635c66d45024043d8c /sw/source/ui/dochdl
parent0b2637dda47690da69f748119081151f41fe4133 (diff)
OLE preview: Limit the GDI metafile size to 100000 actions.
Excel can copy huge metafiles to the clipboard, with over 3 million of actions, which are 1) unusable, and 2) crash LibreOffice because of their size. So let's just limit the size of metafiles to be under 100000 actions, otherwise use the 'OLE' bitmap. Change-Id: I6a50471e6fe6ab9417592c011bf78cad6247236b
Diffstat (limited to 'sw/source/ui/dochdl')
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 085115cdf1fd..9d4acca9e51c 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1816,8 +1816,13 @@ bool SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
Graphic aGraphic;
sal_uLong nGrFormat = 0;
- if( rData.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
+ // limit the size of the preview metafile to 100000 actions
+ GDIMetaFile aMetafile;
+ if (rData.GetGDIMetaFile(FORMAT_GDIMETAFILE, aMetafile, 100000))
+ {
nGrFormat = SOT_FORMAT_GDIMETAFILE;
+ aGraphic = aMetafile;
+ }
// insert replacement image ( if there is one ) into the object helper
if ( nGrFormat )