diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-10-10 17:51:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-10-10 17:51:06 +0200 |
commit | c30d2566d521cfc57aaaa4cf6e3f9ef69e847f3c (patch) | |
tree | d77f1d4baaccd7157f336553a404783b32a1dfba | |
parent | e34906d20c9febc420b115fa2a8b171826dea0be (diff) |
UBSan: Do not downcast to SwFlyFrmFmt prematurely
Change-Id: Ifcc05a5b23630fffed3a2f2636909bd1e1dff1fe
-rw-r--r-- | sw/source/core/undo/undobj.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 4eeccd4b0e92..c85e74af48fb 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; |