Kaydet (Commit) e9e66c61 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#4104 Integer-overflow

Change-Id: Ib5310ebd4f8c7f6a764c2d9e26f66eb2c67dbf07
Reviewed-on: https://gerrit.libreoffice.org/44446Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 1f17927a
...@@ -4245,16 +4245,16 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r ...@@ -4245,16 +4245,16 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
Scale( r ); Scale( r );
Scale( u ); Scale( u );
aObjData.aChildAnchor = tools::Rectangle( l, o, r, u ); aObjData.aChildAnchor = tools::Rectangle( l, o, r, u );
if ( !rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() ) sal_Int32 nWidth, nHeight;
if (!rGlobalChildRect.IsEmpty() && !rClientRect.IsEmpty() && rGlobalChildRect.GetWidth() && rGlobalChildRect.GetHeight() &&
!o3tl::checked_sub(r, l, nWidth) && !o3tl::checked_sub(u, o, nHeight))
{ {
double fWidth = r - l;
double fHeight= u - o;
double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth(); double fXScale = (double)rClientRect.GetWidth() / (double)rGlobalChildRect.GetWidth();
double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight(); double fYScale = (double)rClientRect.GetHeight() / (double)rGlobalChildRect.GetHeight();
double fl = ( ( l - rGlobalChildRect.Left() ) * fXScale ) + rClientRect.Left(); double fl = ( ( l - rGlobalChildRect.Left() ) * fXScale ) + rClientRect.Left();
double fo = ( ( o - rGlobalChildRect.Top() ) * fYScale ) + rClientRect.Top(); double fo = ( ( o - rGlobalChildRect.Top() ) * fYScale ) + rClientRect.Top();
fWidth *= fXScale; double fWidth = nWidth * fXScale;
fHeight *= fYScale; double fHeight = nHeight * fYScale;
aObjData.aChildAnchor = tools::Rectangle( Point( (sal_Int32)fl, (sal_Int32)fo ), Size( (sal_Int32)( fWidth + 1 ), (sal_Int32)( fHeight + 1 ) ) ); aObjData.aChildAnchor = tools::Rectangle( Point( (sal_Int32)fl, (sal_Int32)fo ), Size( (sal_Int32)( fWidth + 1 ), (sal_Int32)( fHeight + 1 ) ) );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment