sc/qa/unit/data/ods/too-many-cols-rows.ods |binary sc/qa/unit/subsequent_filters_test2.cxx | 17 ++++++++++++++--- sc/source/filter/xml/xmlcelli.cxx | 6 ++++++ 3 files changed, 20 insertions(+), 3 deletions(-)
New commits: commit ccad7357b983294ba2f0d8e18f3c2955d7a6d41d Author: Luboš Luňák <[email protected]> AuthorDate: Tue Mar 22 16:46:55 2022 +0100 Commit: Eike Rathke <[email protected]> CommitDate: Thu Mar 24 19:11:11 2022 +0100 warn on too many rows/column when loading ODS There's a warning when loading XLSX, but not when loading ODS. Now that 7.4 is going to support 16k columns, that would be a useful warning, either if we raise the limits again, or backported to 7.2/7.3 . Change-Id: I204bca32e1ff37332b86361d3d81d3fee29c15ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131944 Tested-by: Jenkins Reviewed-by: Eike Rathke <[email protected]> diff --git a/sc/qa/unit/data/ods/too-many-cols-rows.ods b/sc/qa/unit/data/ods/too-many-cols-rows.ods new file mode 100644 index 000000000000..fcf1a0bc9ea8 Binary files /dev/null and b/sc/qa/unit/data/ods/too-many-cols-rows.ods differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 75db57388f41..c40f26dfc78d 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -71,9 +71,7 @@ #include <detfunc.hxx> #include <cellmergeoption.hxx> #include <undoblk.hxx> - -#include <orcusfilters.hxx> -#include <filter.hxx> +#include <scerrors.hxx> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XControlShape.hpp> @@ -209,6 +207,7 @@ public: void testTdf139763ShapeAnchor(); void testAutofilterNamedRangesXLSX(); void testInvalidBareBiff5(); + void testTooManyColsRows(); CPPUNIT_TEST_SUITE(ScFiltersTest2); @@ -316,6 +315,7 @@ public: CPPUNIT_TEST(testTdf139763ShapeAnchor); CPPUNIT_TEST(testAutofilterNamedRangesXLSX); CPPUNIT_TEST(testInvalidBareBiff5); + CPPUNIT_TEST(testTooManyColsRows); CPPUNIT_TEST_SUITE_END(); @@ -3025,6 +3025,17 @@ void ScFiltersTest2::testInvalidBareBiff5() xDocSh->DoClose(); } +void ScFiltersTest2::testTooManyColsRows() +{ + // The intentionally doc has cells beyond our MAXROW/MAXCOL, so there + // should be a warning on load. + ScDocShellRef xDocSh = loadDoc(u"too-many-cols-rows.", FORMAT_ODS); + CPPUNIT_ASSERT(xDocSh.is()); + CPPUNIT_ASSERT(xDocSh->GetErrorCode() == SCWARN_IMPORT_ROW_OVERFLOW + || xDocSh->GetErrorCode() == SCWARN_IMPORT_COLUMN_OVERFLOW); + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index a31a7659cc76..d27b076e1ad6 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1170,7 +1170,10 @@ void ScXMLTableRowCellContext::AddTextAndValueCell( const ScAddress& rCellPos, // it makes no sense to import data after the last supported column // fdo#58539 & gnome#627150 if(rCurrentPos.Col() > pDoc->MaxCol()) + { + rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_COLUMN_OVERFLOW); break; + } if (i > 0) rTables.AddColumn(false); @@ -1183,7 +1186,10 @@ void ScXMLTableRowCellContext::AddTextAndValueCell( const ScAddress& rCellPos, // it makes no sense to import data after last supported row // fdo#58539 & gnome#627150 if(rCurrentPos.Row() > pDoc->MaxRow()) + { + rXMLImport.SetRangeOverflowType(SCWARN_IMPORT_ROW_OVERFLOW); break; + } if( (rCurrentPos.Col() == 0) && (j > 0) ) {
