[Libreoffice-commits] core.git: lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Thu Jan 4 20:39:44 UTC 2018
lotuswordpro/source/filter/lwpgrfobj.cxx | 8 +++++++-
lotuswordpro/source/filter/lwpoleobject.cxx | 6 ++++--
2 files changed, 11 insertions(+), 3 deletions(-)
New commits:
commit 73575a094da28d04f7f515ef186de87adb1403f6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jan 4 11:50:28 2018 +0000
ofz#4923 Divide-by-zero
Change-Id: I0e3420dd908443b570e668b3a2b2ce189f6a14fd
Reviewed-on: https://gerrit.libreoffice.org/47389
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index a615e83e79bd..43e02747b4cc 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -68,6 +68,7 @@
#include "bento.hxx"
#include <lwpglobalmgr.hxx>
+#include <o3tl/numeric.hxx>
#include "lwpframelayout.hxx"
#include <xfilter/xfframe.hxx>
@@ -478,6 +479,9 @@ void LwpGraphicObject::CreateGrafObject()
if (pMyScale && pFrameGeo)
{
+ if (fOrgGrafHeight == 0.0 || fOrgGrafWidth == 0.0)
+ throw o3tl::divide_by_zero();
+
// frame size
double fFrameWidth = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetWidth());
double fFrameHeight = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetHeight());
@@ -510,8 +514,10 @@ void LwpGraphicObject::CreateGrafObject()
fSclGrafWidth = fOrgGrafWidth;
fSclGrafHeight = fOrgGrafHeight;
}
- else if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO && fOrgGrafHeight != 0.0 && fDisFrameHeight != 0.0)
+ else if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO)
{
+ if (fDisFrameHeight == 0.0)
+ throw o3tl::divide_by_zero();
if (fOrgGrafWidth/fOrgGrafHeight >= fDisFrameWidth/fDisFrameHeight)
{
fSclGrafWidth = fDisFrameWidth;
diff --git a/lotuswordpro/source/filter/lwpoleobject.cxx b/lotuswordpro/source/filter/lwpoleobject.cxx
index 66cee7b776e6..177508b89082 100644
--- a/lotuswordpro/source/filter/lwpoleobject.cxx
+++ b/lotuswordpro/source/filter/lwpoleobject.cxx
@@ -66,6 +66,7 @@
#include "lwp9reader.hxx"
#include <xfilter/xfparagraph.hxx>
#include "lwpframelayout.hxx"
+#include <o3tl/numeric.hxx>
#include <xfilter/xfstylemanager.hxx>
#include "bento.hxx"
@@ -154,8 +155,10 @@ void LwpGraphicOleObject::GetGrafScaledSize(double & fWidth, double & fHeight)
fSclGrafWidth = fWidth;
fSclGrafHeight = fHeight;
}
- else if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO && fHeight != 0.0 && fDisFrameHeight != 0.0)
+ else if (nScalemode & LwpLayoutScale::MAINTAIN_ASPECT_RATIO)
{
+ if (fHeight == 0.0 || fDisFrameHeight == 0.0)
+ throw o3tl::divide_by_zero();
if (fWidth/fHeight >= fDisFrameWidth/fDisFrameHeight)
{
fSclGrafWidth = fDisFrameWidth;
@@ -177,7 +180,6 @@ void LwpGraphicOleObject::GetGrafScaledSize(double & fWidth, double & fHeight)
}
fWidth = fSclGrafWidth ;
fHeight = fSclGrafHeight ;
-
}
/**
More information about the Libreoffice-commits
mailing list