summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-04-23 09:27:00 +0300
committerAndras Timar <andras.timar@collabora.com>2018-05-15 10:13:40 +0200
commit30bdd0bc5c59860025e7d17116cd60193986edab (patch)
treeec598610a1ab99022be1405fbee6402877e20e70 /sw/source/filter
parenta55ea353a56f1fae6c216cc87674de8a269648ea (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/53329 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 9b55701b88c42cac491587072f1f09522207de77)
Diffstat (limited to 'sw/source/filter')
-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 fde01e6ad296..4035d583c1ba 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -579,10 +579,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