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

Armin Le Grand alg at apache.org
Thu Jul 11 03:41:46 PDT 2013


 cui/source/tabpages/swpossizetabpage.cxx |    4 +++-
 cui/source/tabpages/textattr.cxx         |    4 +++-
 cui/source/tabpages/transfrm.cxx         |    6 +++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 8d92c5d1fa4216749c48e34e471f5362a0906a32
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Jul 11 09:19:43 2013 +0000

    Resolves: #i121917# secure SdrTextObj casts in cui
    
    (cherry picked from commit 005cd2d436221519f74e54fb2373c7cbece6aed0)
    
    Change-Id: If38213ec9bce63aab97ad9d32273c05860e583ee

diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 24ce240..1da5012 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1832,7 +1832,9 @@ void SvxSwPosSizeTabPage::SetView( const SdrView* pSdrView )
         SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
         if( ( pObj->GetObjInventor() == SdrInventor ) &&
             ( eKind==OBJ_TEXT || eKind==OBJ_TITLETEXT || eKind==OBJ_OUTLINETEXT) &&
-            ( (SdrTextObj*) pObj )->HasText() )
+            // #i121917# The original ((SdrTextObj*)pObj)->HasText() will fail badly with SdrVirtObjs from Writer
+            0 != dynamic_cast< const SdrTextObj* >(pObj) &&
+            static_cast< const SdrTextObj* >(pObj)->HasText() )
         {
             OSL_FAIL("AutoWidth/AutoHeight should be enabled");
         }
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index 37a7212..aaf5e0a 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -494,7 +494,9 @@ void SvxTextAttrPage::Construct()
                 case OBJ_OUTLINETEXT :
                 case OBJ_CAPTION :
                 {
-                    if ( ((SdrTextObj*)pObj)->HasText() )
+                    if( // #i121917# The original ((SdrTextObj*)pObj)->HasText() will fail badly with SdrVirtObjs from Writer
+                        0 != dynamic_cast< const SdrTextObj* >(pObj) &&
+                        static_cast< const SdrTextObj* >(pObj)->HasText() )
                     {
                         // contour NOT possible for pure text objects
                         bContourEnabled = sal_False;
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 9cd709f..b79795d 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -786,7 +786,11 @@ void SvxPositionSizeTabPage::Construct()
         const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
         const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier());
 
-        if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText())
+        if((pObj->GetObjInventor() == SdrInventor) &&
+            (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) &&
+            // #i121917# The original ((SdrTextObj*)pObj)->HasText() will fail badly with SdrVirtObjs from Writer
+            0 != dynamic_cast< const SdrTextObj* >(pObj) &&
+            static_cast< const SdrTextObj* >(pObj)->HasText())
         {
             mbAdjustDisabled = false;
             maFlAdjust.Enable();


More information about the Libreoffice-commits mailing list