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

Stephan Bergmann sbergman at redhat.com
Fri Oct 10 08:51:34 PDT 2014


 sw/source/core/undo/undobj.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit c30d2566d521cfc57aaaa4cf6e3f9ef69e847f3c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 10 17:51:06 2014 +0200

    UBSan: Do not downcast to SwFlyFrmFmt prematurely
    
    Change-Id: Ifcc05a5b23630fffed3a2f2636909bd1e1dff1fe

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 4eeccd4..c85e74af 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -561,14 +561,14 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
         if( !rSpzArr.empty() )
         {
             const bool bDelFwrd = rMark.nNode.GetIndex() <= rPoint.nNode.GetIndex();
-            SwFlyFrmFmt* pFmt;
+            SwFrmFmt* pFmt;
             const SwFmtAnchor* pAnchor;
             size_t n = rSpzArr.size();
             const SwPosition* pAPos;
 
             while( n && !rSpzArr.empty() )
             {
-                pFmt = (SwFlyFrmFmt*)rSpzArr[--n];
+                pFmt = rSpzArr[--n];
                 pAnchor = &pFmt->GetAnchor();
                 switch( pAnchor->GetAnchorId() )
                 {
@@ -630,7 +630,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
                                 }
                                 else
                                 {
-                                    pHistory->Add( *pFmt, nChainInsPos );
+                                    pHistory->Add( *static_cast<SwFlyFrmFmt *>(pFmt), nChainInsPos );
                                     // reset n so that no Format is skipped
                                     n = n >= rSpzArr.size() ?
                                         rSpzArr.size() : n+1;
@@ -648,7 +648,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
                         if (IsDestroyFrameAnchoredAtChar(
                                 *pAPos, *pStt, *pEnd, pDoc, nDelCntntType))
                         {
-                            pHistory->Add( *pFmt, nChainInsPos );
+                            pHistory->Add( *static_cast<SwFlyFrmFmt *>(pFmt), nChainInsPos );
                             n = n >= rSpzArr.size() ? rSpzArr.size() : n+1;
                         }
                         else if( !( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType ) )
@@ -677,7 +677,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
                         if( !pHistory )
                             pHistory = new SwHistory;
 
-                        pHistory->Add( *pFmt, nChainInsPos );
+                        pHistory->Add( *static_cast<SwFlyFrmFmt *>(pFmt), nChainInsPos );
 
                         // reset n so that no Format is skipped
                         n = n >= rSpzArr.size() ? rSpzArr.size() : n+1;


More information about the Libreoffice-commits mailing list