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

Stephan Bergmann sbergman at redhat.com
Fri Nov 3 17:45:54 UTC 2017


 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit a5c4b406a8ff80aaa2df96ce455d3b080b77a9a4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Nov 3 18:42:44 2017 +0100

    Only downcast to OOXMLFastContextHandlerShape when actually necessary
    
    After bd3c5c4c234e3dc6b89cd235321945a41a08d562 "[API CHANGE] tdf#65393 Import
    signature line images from ooxml", UBSan CppunitTest_chart2_export had started
    to fail with
    
    > writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:1898:25: runtime error: downcast of address 0x61200070a440 which does not point to an object of type 'writerfilter::ooxml::OOXMLFastContextHandlerShape'
    > 0x61200070a440: note: object is of type 'writerfilter::ooxml::OOXMLFastContextHandlerWrapper'
    >  0e 10 00 20  50 86 4a 00 a2 7f 00 00  01 00 00 00 be be be be  00 00 00 00 00 00 00 00  00 00 00 00
    >               ^~~~~~~~~~~~~~~~~~~~~~~
    >               vptr for 'writerfilter::ooxml::OOXMLFastContextHandlerWrapper'
    
    Change-Id: I028ef619766466e8cd9bb0ca09174b926fc6d23c

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index e25e7bc40fae..138954023f89 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1895,11 +1895,10 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
     // here until we need a more generic solution.
     bool bIsWrap = Element == static_cast<sal_Int32>(NMSP_vmlWord | XML_wrap);
     bool bIsSignatureLine = Element == static_cast<sal_Int32>(NMSP_vmlOffice | XML_signatureline);
-    bool bIsShapeSent = static_cast<OOXMLFastContextHandlerShape*>(mpParent)->isShapeSent();
     bool bSkipImages = getDocument()->IsSkipImages() && oox::getNamespace(Element) == static_cast<sal_Int32>(NMSP_dml) &&
         !((oox::getBaseToken(Element) == XML_linkedTxbx) || (oox::getBaseToken(Element) == XML_txbx));
 
-    if ( bInNamespaces && ((!bIsWrap && !bIsSignatureLine) || bIsShapeSent) )
+    if ( bInNamespaces && ((!bIsWrap && !bIsSignatureLine) || static_cast<OOXMLFastContextHandlerShape*>(mpParent)->isShapeSent()) )
         xResult.set(OOXMLFactory::createFastChildContextFromStart(this, Element));
     else if (mxContext.is()  && !bSkipImages)
     {


More information about the Libreoffice-commits mailing list