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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 17 19:20:32 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx       |    2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx        |    4 ++--
 writerfilter/source/dmapper/ConversionHelper.cxx |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 00710aebdf339415f1fa2072ef6a76c8bb6a591a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 17 09:07:19 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jan 17 20:19:56 2020 +0100

    ofz#20169 Integer-overflow
    
    runtime error: signed integer overflow: -2147478239 * 127 cannot be represented in type 'int'
    
    72 points in an inch, TWentyInPoint TWIPs in a point,
    1440 twips in an inch, 25.4 mm in an inch
    
    Change-Id: I4ea1c524cd9a16ab6e58ccf2a19fb8e41d68ffe6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86955
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 6aeec25e80b6..a7803e1aad75 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -433,7 +433,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69656, "Table_cell_auto_width_fdo69656.docx")
 {
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(8154), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(8153), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFloatingTablesAnchor, "floating-tables-anchor.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 8972bb3fddd0..0a575a103491 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1022,7 +1022,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableAutoColumnFixedSize2, "table-auto-column-fixed
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
     uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
     // This was 17907, i.e. the sum of the width of the 3 cells (10152 twips each), which is too wide.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(16893), getProperty<sal_Int32>(xTextTable, "Width"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(16891), getProperty<sal_Int32>(xTextTable, "Width"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo46361, "fdo46361.docx")
@@ -1068,7 +1068,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66474, "fdo66474.docx")
     // The table width was too small, so the text in the second cell was unreadable: this was 1397.
     uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(10493), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(10492), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testGroupshapeRotation, "groupshape-rotation.docx")
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index 6c498ebb4870..d82614cc931c 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -423,7 +423,7 @@ double convertTwipToMM100Double(sal_Int32 _t)
     // anything that's bigger than 32767 appears to be simply ignored.
     if( _t >= 0x8000 )
         return 0.0;
-    return (_t >= 0)? (_t*127+36)/72.0: (_t*127-36)/72.0;
+    return _t * 254.0 / 144.0;
 }
 
 sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t)


More information about the Libreoffice-commits mailing list