diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-01-05 20:54:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-01-05 21:57:28 +0100 |
commit | 9fff5632a91c8d396116565162cf0a5b4fa9875f (patch) | |
tree | 145e32c6a708a88b01066d6f3311d14930d3d9ce | |
parent | 6007cdaabe1694ca8804ba816dbd87885dd3d8ac (diff) |
ofz#4879 Divide-by-zero
Change-Id: I0df4bc2c8d9c5d5f95141b585826fc773a1fde3e
Reviewed-on: https://gerrit.libreoffice.org/47484
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | lotuswordpro/source/filter/lwppagelayout.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index fc5d77ab90de..193bdbbedb69 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -63,6 +63,7 @@ #include "lwppagehint.hxx" #include "lwpdivinfo.hxx" #include "lwpstory.hxx" +#include <o3tl/numeric.hxx> #include <xfilter/xfstylemanager.hxx> #include <xfilter/xfmasterpage.hxx> #include <xfilter/xfcontentcontainer.hxx> @@ -273,8 +274,12 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1) } if(rFootnoteSep.HasCustomLength()) { - nLengthPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength())/GetMarginWidth()); - if(nLengthPercent > 100) + const double fMarginWidth = GetMarginWidth(); + if (fMarginWidth == 0.0) + throw o3tl::divide_by_zero(); + + nLengthPercent = static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength()) / fMarginWidth); + if (nLengthPercent > 100) nLengthPercent = 100; } double fAbove = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetAbove()); |