[Libreoffice-commits] core.git: embeddedobj/source
Tor Lillqvist
tml at collabora.com
Wed Aug 27 05:09:58 PDT 2014
embeddedobj/source/inc/oleembobj.hxx | 1 +
embeddedobj/source/msole/oleembed.cxx | 14 +++++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
New commits:
commit 46ad54725bf28ea75278eb63dbf95c4a29618c1c
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Aug 27 14:29:43 2014 +0300
bnc#648251: Avoid crash when attempting to open embedded OLE object as "text"
On non-Windows, when double-clicking an embedded OLE object, our glorious
content type detection logic detects it as "Text". As a side-effect, we start
to calculate text statistics on it. Which surely could produce interesting
numbers (you know what they say about statistics), but sadly causes a crash
involving the ICU RuleBasedBreakIterator, SwScanner,
sw::DocumentStatisticsManager and whatnot.
Avoid this by checking for a detected filter of type "Text" explicitly, and
avoiding the fun code paths in that case.
This leads to double-clicks being just ignored. Maybe it would be more useful
to produce a "General OLE Error" message box?
Change-Id: Iae0726b5e9c511a92bdff7229d2978cbf76cb07b
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx
index 4215274..4fa109e 100644
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -191,6 +191,7 @@ class OleEmbeddedObject : public ::cppu::WeakImplHelper5
// if the following member is set, the object works in wrapper mode
::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > m_xWrappedObject;
bool m_bTriedConversion;
+ OUString m_aFilterName; // if m_bTriedConversion, then the filter detected by that
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 144ecf5..5c9df30 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -265,18 +265,18 @@ bool OleEmbeddedObject::TryToConvertToOOo()
// the stream must be seekable
uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY_THROW );
xSeekable->seek( 0 );
- OUString aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( m_xFactory, OUString(), m_xObjectStream->getInputStream() );
+ m_aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( m_xFactory, OUString(), m_xObjectStream->getInputStream() );
// use the solution only for OOXML format currently
- if ( !aFilterName.isEmpty()
- && ( aFilterName == "Calc MS Excel 2007 XML" || aFilterName == "Impress MS PowerPoint 2007 XML" || aFilterName == "MS Word 2007 XML" ) )
+ if ( !m_aFilterName.isEmpty()
+ && ( m_aFilterName == "Calc MS Excel 2007 XML" || m_aFilterName == "Impress MS PowerPoint 2007 XML" || m_aFilterName == "MS Word 2007 XML" ) )
{
uno::Reference< container::XNameAccess > xFilterFactory(
m_xFactory->createInstance("com.sun.star.document.FilterFactory"),
uno::UNO_QUERY_THROW );
OUString aDocServiceName;
- uno::Any aFilterAnyData = xFilterFactory->getByName( aFilterName );
+ uno::Any aFilterAnyData = xFilterFactory->getByName( m_aFilterName );
uno::Sequence< beans::PropertyValue > aFilterData;
if ( aFilterAnyData >>= aFilterData )
{
@@ -309,7 +309,7 @@ bool OleEmbeddedObject::TryToConvertToOOo()
aArgs[1].Name = "ReadOnly";
aArgs[1].Value <<= sal_True;
aArgs[2].Name = "FilterName";
- aArgs[2].Value <<= aFilterName;
+ aArgs[2].Value <<= m_aFilterName;
aArgs[3].Name = "URL";
aArgs[3].Value <<= OUString( "private:stream" );
aArgs[4].Name = "InputStream";
@@ -838,7 +838,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
}
}
- if ( !m_pOwnView && m_xObjectStream.is() )
+ if ( !m_pOwnView && m_xObjectStream.is() && m_aFilterName != "Text" )
{
try {
uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY );
@@ -859,7 +859,7 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
}
}
- if ( !m_pOwnView || !m_pOwnView->Open() )
+ if ( m_aFilterName != "Text" && (!m_pOwnView || !m_pOwnView->Open()) )
{
//Make a RO copy and see if the OS can find something to at
//least display the content for us
More information about the Libreoffice-commits
mailing list