[Libreoffice-commits] core.git: 4 commits - writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Sat Mar 29 13:53:06 PDT 2014


 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    2 ++
 writerfilter/source/ooxml/OOXMLStreamImpl.cxx         |   14 ++++++++------
 writerfilter/source/rtftok/rtfdocumentimpl.cxx        |    3 ++-
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 6812606517e9a6299fcd5fde59fd4cf414d0d493
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Mar 29 21:41:52 2014 +0100

    coverity#736006 Unchecked dynamic_cast
    
    Change-Id: Id4b0f5e6e4369a850bc159992540e024a4c37c3c

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 776f1de..cf7b0d6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4633,7 +4633,8 @@ int RTFDocumentImpl::popState()
                 // to RTLD_GLOBAL, so most probably a gcc bug.
                 oox::FormulaImportBase* pImport = dynamic_cast<oox::FormulaImportBase*>(dynamic_cast<SfxBaseModel*>(xComponent.get()));
                 assert( pImport != NULL );
-                pImport->readFormulaOoxml(m_aMathBuffer);
+                if (pImport)
+                    pImport->readFormulaOoxml(m_aMathBuffer);
                 RTFValue::Pointer_t pValue(new RTFValue(xObject));
                 RTFSprms aMathAttributes;
                 aMathAttributes.set(NS_ooxml::LN_starmath, pValue);
commit b4107c79fb680c1906a7a4978c0c2eb5c118a41c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Mar 29 21:39:54 2014 +0100

    coverity#705083 Unchecked dynamic_cast
    
    Change-Id: I58e7be8d7b78ba83356e169290c289f246e93057

diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index c66178f..494011f 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -455,9 +455,10 @@ OOXMLStream::Pointer_t
 OOXMLDocumentFactory::createStream
 (OOXMLStream::Pointer_t pStream, const OUString & rId)
 {
-    return OOXMLStream::Pointer_t
-        (new OOXMLStreamImpl(*dynamic_cast<OOXMLStreamImpl *>(pStream.get()),
-                             rId));
+    OOXMLStream::Pointer_t pRet;
+    if (OOXMLStreamImpl* pImpl = dynamic_cast<OOXMLStreamImpl *>(pStream.get()))
+        pRet.reset(new OOXMLStreamImpl(*pImpl, rId));
+    return pRet;
 }
 
 }}
commit 7030c700bfeab64a65947d52daa24b5ffefb81ae
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Mar 29 21:38:11 2014 +0100

    coverity#705082 Unchecked dynamic_cast
    
    Change-Id: Ic4665f2cbd2bfc4b65a0f3d9d746e344d4f3bef8

diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index 284d369..c66178f 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -445,9 +445,10 @@ OOXMLStream::Pointer_t
 OOXMLDocumentFactory::createStream
 (OOXMLStream::Pointer_t pStream,  OOXMLStream::StreamType_t nStreamType)
 {
-    return OOXMLStream::Pointer_t
-        (new OOXMLStreamImpl(*dynamic_cast<OOXMLStreamImpl *>(pStream.get()),
-                             nStreamType));
+    OOXMLStream::Pointer_t pRet;
+    if (OOXMLStreamImpl* pImpl = dynamic_cast<OOXMLStreamImpl *>(pStream.get()))
+        pRet.reset(new OOXMLStreamImpl(*pImpl, nStreamType));
+    return pRet;
 }
 
 OOXMLStream::Pointer_t
commit 8d5efb49c37c4e78ef233570e0ead9fedc32d80e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Mar 29 21:34:10 2014 +0100

    coverity#736005 Unchecked dynamic_cast
    
    Change-Id: Ieca4f06f3ca4fecb8a0e87e7528f8583a549013c

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 14e0c3c..4f73da5 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2570,6 +2570,8 @@ void OOXMLFastContextHandlerMath::process()
 // to RTLD_GLOBAL, so most probably a gcc bug.
     oox::FormulaImportBase* import = dynamic_cast< oox::FormulaImportBase* >( dynamic_cast< SfxBaseModel* >(component.get()));
     assert( import != NULL );
+    if (!import)
+        return;
     import->readFormulaOoxml( buffer );
     if (isForwardEvents())
     {


More information about the Libreoffice-commits mailing list