summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-04-18 15:50:24 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-04-26 14:03:24 +0200
commit536dba7c9258dc836ac85a4c927c367187a73806 (patch)
tree17f65b86ac6f69019dc3be00785808be130d0e6f
parentFix tdf#155004: ucb: webdav-curl: carry over Class1 bit only if set (diff)
downloadcore-536dba7c9258dc836ac85a4c927c367187a73806.tar.gz
core-536dba7c9258dc836ac85a4c927c367187a73806.zip
sw: fix divide by 0 in SwFlyFrame::CalcRel
https: //crashreport.libreoffice.org/stats/signature/SwFlyFrame::CalcRel(SwFormatFrameSize%20const%20&) Change-Id: If7a1919a2829bbec3292b3aa5f7f719c5ba0beef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150579 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 6f36e44f248c8e3705779d6692daaf79865a1378) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150566 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 03300969235b9d7ffcc4d4b3168215ee927ddaf2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150572 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sw/source/core/layout/fly.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 4cee6d9e712d..09834d7defd0 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2580,12 +2580,12 @@ Size SwFlyFrame::CalcRel( const SwFormatFrameSize &rSz ) const
if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != SwFormatFrameSize::SYNCED )
aRet.setHeight( nRelHeight * rSz.GetHeightPercent() / 100 );
- if ( rSz.GetWidthPercent() == SwFormatFrameSize::SYNCED )
+ if ( rSz.GetHeight() && rSz.GetWidthPercent() == SwFormatFrameSize::SYNCED )
{
aRet.setWidth( aRet.Width() * ( aRet.Height()) );
aRet.setWidth( aRet.Width() / ( rSz.GetHeight()) );
}
- else if ( rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
+ else if ( rSz.GetWidth() && rSz.GetHeightPercent() == SwFormatFrameSize::SYNCED )
{
aRet.setHeight( aRet.Height() * ( aRet.Width()) );
aRet.setHeight( aRet.Height() / ( rSz.GetWidth()) );