summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-02 10:41:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-02 14:21:20 +0100
commitd2281e20d96c640998530f3fb577b87ee85426f1 (patch)
treeca6baf5acb00e788581123f32c0afd02c9d3dc90 /sc
parent78cab9dc44009351ec1f19376b0594cb4a110814 (diff)
fix crash on loading certain xls
Change-Id: I2dd58060c1f3c9f12356c4ab18a0c838e7cdd718
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xls/pass/crash-1.xlsbin4096 -> 183 bytes
-rw-r--r--sc/source/filter/excel/impop.cxx24
2 files changed, 13 insertions, 11 deletions
diff --git a/sc/qa/unit/data/xls/pass/crash-1.xls b/sc/qa/unit/data/xls/pass/crash-1.xls
index 724bfc1a6f14..4b801ea3933b 100644
--- a/sc/qa/unit/data/xls/pass/crash-1.xls
+++ b/sc/qa/unit/data/xls/pass/crash-1.xls
Binary files differ
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index a08bd1468b3f..4339ae40bca0 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);