[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Thu Apr 26 18:18:20 UTC 2018


 sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc |binary
 sw/source/filter/ww8/ww8graf2.cxx               |    3 ++-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9e450605d8a5675a8bbabfffe167a72286f1731a
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Apr 23 09:27:00 2018 +0300

    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 at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc b/sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc
new file mode 100644
index 000000000000..9fca8ef048ae
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc differ
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


More information about the Libreoffice-commits mailing list