summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-08-31 14:22:15 +0530
committerAndras Timar <andras.timar@collabora.com>2017-09-08 11:38:36 +0200
commit5f85c70dc299ee27d5d94d6bb3eaabf0aba5fa58 (patch)
treeeda12ced928a0a097a27534b2ec65e14e30c12f1
parent2b94af6b30700434b82eaaa0a49e35f42b32fa4b (diff)
tdf#111974: Ensure sufficient space for all sheets in FormulaBuffer...
and not just for the number of sheet fragments. This is important because we changed the internal storage of FormulaBuffer from based on std::map to std::vector in d17a83fa549f828f29e6939b16ba8b568a75f95e Added simple unit test that loads the bugdoc in subsequent_filters-test.cxx Reviewed-on: https://gerrit.libreoffice.org/41792 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Dennis Francis <dennis.francis@collabora.co.uk> (cherry picked from commit 20169423d492b58ab93fb0e8e9d2918c0baebc92) Reviewed-on: https://gerrit.libreoffice.org/41841 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Conflicts: sc/qa/unit/subsequent_filters-test.cxx Backported. Change-Id: I7320dd537266e540d585d3fccfbb8665bba457c7 Reviewed-on: https://gerrit.libreoffice.org/42057 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 500b5727fd5902b7d14c6e707c2ad3d2b227bb1a)
-rw-r--r--sc/qa/unit/data/xlsm/tdf111974.xlsmbin0 -> 338812 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx10
-rw-r--r--sc/source/filter/oox/workbookfragment.cxx2
3 files changed, 11 insertions, 1 deletions
diff --git a/sc/qa/unit/data/xlsm/tdf111974.xlsm b/sc/qa/unit/data/xlsm/tdf111974.xlsm
new file mode 100644
index 000000000000..bb6ac6d0a2d3
--- /dev/null
+++ b/sc/qa/unit/data/xlsm/tdf111974.xlsm
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 5c5e730ef591..b53803c4e425 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -241,6 +241,7 @@ public:
void testTdf100458();
void testTdf100709XLSX();
void testTdf97598XLSX();
+ void testTdf111974XLSM();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -359,6 +360,7 @@ public:
CPPUNIT_TEST(testTdf100458);
CPPUNIT_TEST(testTdf100709XLSX);
CPPUNIT_TEST(testTdf97598XLSX);
+ CPPUNIT_TEST(testTdf111974XLSM);
CPPUNIT_TEST_SUITE_END();
@@ -3778,6 +3780,14 @@ void ScFiltersTest::testColumnStyle2XLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testTdf111974XLSM()
+{
+ // Would crash without the fix on loading
+ ScDocShellRef xDocSh = loadDoc("tdf111974.", FORMAT_XLSM);
+ CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is());
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testBnc762542()
{
ScDocShellRef xDocSh = loadDoc("bnc762542.", FORMAT_XLSX);
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 53ae02fc26b9..37e196aae1d5 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -452,7 +452,7 @@ void WorkbookFragment::finalizeImport()
}
// setup structure sizes for the number of sheets
- getFormulaBuffer().SetSheetCount( aSheetFragments.size() );
+ getFormulaBuffer().SetSheetCount( nWorksheetCount );
// create all database ranges and defined names, in that order
getTables().finalizeImport();