summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8graf2.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-04-23 09:27:00 +0300
committerJustin Luth <justin_luth@sil.org>2018-04-26 20:17:50 +0200
commit9e450605d8a5675a8bbabfffe167a72286f1731a (patch)
treeb70d5e540b21e8099f0c8040a3bb1ae9a083545c /sw/source/filter/ww8/ww8graf2.cxx
parent45f20a893a457a40604207382611afd2f8e4b635 (diff)
tdf#117129 ww8import: prevent divide-by-zero
Before commit ffc3358515799057e72379b76a1165c6ea5a9bd1 for tdf#75539, the divisor was hard-coded at 1000. The preceeding code also notes that an undefined relativeWidth is forced to 1000. So, on an invalid divisor, revert to previous behaviour. Change-Id: I40210194eec39682d9ab3ce68268d343af16e2b1 Reviewed-on: https://gerrit.libreoffice.org/53308 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/source/filter/ww8/ww8graf2.cxx')
-rw-r--r--sw/source/filter/ww8/ww8graf2.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 6cda45844ac1..2998c26f93f3 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -584,10 +584,11 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj,
relativeWidth = pRecord->isHorizontalRule ? 1000 : 0;
if( relativeWidth != 0 )
{
+ const sal_Int16 nScale = aPic.dxaGoal ? aPic.dxaGoal : 1000;
aPic.mx = msword_cast<sal_uInt16>(
m_aSectionManager.GetPageWidth() -
m_aSectionManager.GetPageRight() -
- m_aSectionManager.GetPageLeft()) * relativeWidth / aPic.dxaGoal;
+ m_aSectionManager.GetPageLeft()) * relativeWidth / nScale;
aPD = WW8PicDesc( aPic );
// This SetSnapRect() call adjusts the size of the
// object itself, no idea why it's this call (or even