[Libreoffice-commits] core.git: sc/CppunitTest_sc_filters_test.mk sc/inc sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Aug 4 19:32:39 UTC 2018


 sc/CppunitTest_sc_filters_test.mk  |    1 +
 sc/inc/testlotus.hxx               |   16 ++++++++++++++++
 sc/qa/unit/data/123/ofz9704.123    |binary
 sc/qa/unit/filters-test.cxx        |   11 +++++++++++
 sc/source/core/tool/compiler.cxx   |    6 +++++-
 sc/source/filter/lotus/lotread.cxx |    1 +
 6 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 042a8282430ff87baa3ad4bf51e2349c01c93ec2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 3 15:54:53 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Aug 4 21:32:17 2018 +0200

    ofz#9704 null deref
    
    Change-Id: Ieb3854af97a7c5cbe5679de09925f6802757ebf1
    Reviewed-on: https://gerrit.libreoffice.org/58567
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk
index 0a2b9a757362..32a9199a5031 100644
--- a/sc/CppunitTest_sc_filters_test.mk
+++ b/sc/CppunitTest_sc_filters_test.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_filters_test, \
     salhelper \
     sax \
     sc \
+    scfilt \
     scqahelper \
     sfx \
     sot \
diff --git a/sc/inc/testlotus.hxx b/sc/inc/testlotus.hxx
new file mode 100644
index 000000000000..aeaf359124f3
--- /dev/null
+++ b/sc/inc/testlotus.hxx
@@ -0,0 +1,16 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "scdll.hxx"
+
+class SvStream;
+
+extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportWKS(SvStream& rStream);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/data/123/ofz9704.123 b/sc/qa/unit/data/123/ofz9704.123
new file mode 100644
index 000000000000..20464391a298
Binary files /dev/null and b/sc/qa/unit/data/123/ofz9704.123 differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 144a5babac9e..1b8b99bda2db 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -33,6 +33,7 @@
 #include <userdat.hxx>
 #include <formulacell.hxx>
 #include <tabprotection.hxx>
+#include <testlotus.hxx>
 #include <dbdocfun.hxx>
 #include <globalnames.hxx>
 #include <dbdata.hxx>
@@ -72,6 +73,7 @@ public:
     void testContentXLSX();
     void testContentXLSXStrict(); // strict OOXML
     void testContentLotus123();
+    void testContentofz9704();
     void testContentDIF();
     void testContentXLSB();
     void testContentXLS_XML();
@@ -95,6 +97,7 @@ public:
     CPPUNIT_TEST(testContentXLSX);
     CPPUNIT_TEST(testContentXLSXStrict);
     CPPUNIT_TEST(testContentLotus123);
+    CPPUNIT_TEST(testContentofz9704);
     CPPUNIT_TEST(testContentDIF);
     CPPUNIT_TEST(testContentXLSB);
     CPPUNIT_TEST(testContentXLS_XML);
@@ -302,6 +305,14 @@ void ScFiltersTest::testContentLotus123()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testContentofz9704()
+{
+    OUString aFileName;
+    createFileURL("ofz9704.", "123", aFileName);
+    SvFileStream aFileStream(aFileName, StreamMode::READ);
+    TestImportWKS(aFileStream);
+}
+
 void ScFiltersTest::testContentDIF()
 {
     ScDocShellRef xDocSh = loadDoc("universal-content.", FORMAT_DIF);
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 899871d42404..54e816b5ff7a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5989,7 +5989,11 @@ void ScCompiler::PostProcessCode()
 
 void ScCompiler::ReplaceDoubleRefII(FormulaToken** ppDoubleRefTok)
 {
-    const ScComplexRefData& rRange = *(*ppDoubleRefTok)->GetDoubleRef();
+    const ScComplexRefData* pRange = (*ppDoubleRefTok)->GetDoubleRef();
+    if (!pRange)
+        return;
+
+    const ScComplexRefData& rRange = *pRange;
 
     // Can't do optimization reliably in this case (when row references are absolute).
     // Example : =SIN(A$1:A$10) filled in a formula group starting at B5 and of length 100.
diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx
index ee2ea3a434c6..5be4db478cfc 100644
--- a/sc/source/filter/lotus/lotread.cxx
+++ b/sc/source/filter/lotus/lotread.cxx
@@ -26,6 +26,7 @@
 #include "lotfilter.hxx"
 #include <lotimpop.hxx>
 #include <lotattr.hxx>
+#include <testlotus.hxx>
 #include <fprogressbar.hxx>
 
 #include <sal/log.hxx>


More information about the Libreoffice-commits mailing list