[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/qa sc/source

Caolán McNamara caolanm at redhat.com
Sat Oct 3 05:08:57 PDT 2015


 sc/qa/unit/data/xls/pass/crash-1.xls |binary
 sc/source/filter/excel/impop.cxx     |   24 +++++++++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 070693d7209a2afa9d39384a186081139d96cf95
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 2 10:41:25 2015 +0100

    fix crash on loading certain xls
    
    Change-Id: I2dd58060c1f3c9f12356c4ab18a0c838e7cdd718
    (cherry picked from commit d2281e20d96c640998530f3fb577b87ee85426f1)
    Reviewed-on: https://gerrit.libreoffice.org/19097
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/qa/unit/data/xls/pass/crash-1.xls b/sc/qa/unit/data/xls/pass/crash-1.xls
index 724bfc1..4b801ea3 100644
Binary files a/sc/qa/unit/data/xls/pass/crash-1.xls and b/sc/qa/unit/data/xls/pass/crash-1.xls differ
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 34dc2c9..e252185 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -520,13 +520,11 @@ void ImportExcel::Columndefault()
 
 void ImportExcel::Array25()
 {
-    sal_uInt16      nFirstRow, nLastRow, nFormLen;
-    sal_uInt8       nFirstCol, nLastCol;
-
-    nFirstRow = aIn.ReaduInt16();
-    nLastRow = aIn.ReaduInt16();
-    nFirstCol = aIn.ReaduInt8();
-    nLastCol = aIn.ReaduInt8();
+    sal_uInt16 nFormLen;
+    sal_uInt16 nFirstRow = aIn.ReaduInt16();
+    sal_uInt16 nLastRow = aIn.ReaduInt16();
+    sal_uInt8 nFirstCol = aIn.ReaduInt8();
+    sal_uInt8 nLastCol = aIn.ReaduInt8();
 
     if( GetBiff() == EXC_BIFF2 )
     {//                     BIFF2
@@ -539,17 +537,21 @@ void ImportExcel::Array25()
         nFormLen = aIn.ReaduInt16();
     }
 
-    if( ValidColRow( nLastCol, nLastRow ) )
+    const ScTokenArray* pErgebnis = nullptr;
+
+    if (ValidColRow(nLastCol, nLastRow))
     {
         // the read mark is now on the formula, length in nFormLen
-        const ScTokenArray* pErgebnis;
 
         pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
                     static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
-        pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
+        pFormConv->Convert(pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
 
-        OSL_ENSURE( pErgebnis, "*ImportExcel::Array25(): ScTokenArray is NULL!" );
+        SAL_WARN_IF(!pErgebnis, "sc", "*ImportExcel::Array25(): ScTokenArray is NULL!");
+    }
 
+    if (pErgebnis)
+    {
         ScDocumentImport& rDoc = GetDocImport();
         ScRange aArrayRange(nFirstCol, nFirstRow, GetCurrScTab(), nLastCol, nLastRow, GetCurrScTab());
         rDoc.setMatrixCells(aArrayRange, *pErgebnis, formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);


More information about the Libreoffice-commits mailing list