From be4f7ea3f6c8bddba3ca1ae3d9d9e67449bbc3cb Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 4 Mar 2014 20:41:02 +0100 Subject: 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 --- svtools/source/misc/transfer.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'svtools') diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index a7b63547c57f..def8b3d54ae0 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -1777,10 +1777,12 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE -sal_Bool TransferableDataHelper::GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf ) +sal_Bool TransferableDataHelper::GetGDIMetaFile(SotFormatStringId nFormat, GDIMetaFile& rMtf, size_t nMaxActions) { DataFlavor aFlavor; - return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetGDIMetaFile( aFlavor, rMtf ) ); + return SotExchange::GetFormatDataFlavor(nFormat, aFlavor) && + GetGDIMetaFile(aFlavor, rMtf) && + (nMaxActions == 0 || rMtf.GetActionSize() < nMaxActions); } -- cgit