sc/qa/unit/ucalc_formula.cxx | 6 +++--- sc/source/core/inc/arraysumfunctor.hxx | 7 +++++-- sc/source/core/tool/scmatrix.cxx | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-)
New commits: commit cb01ea920550769e8a04b3cb809c70ed324ba342 Author: Marco Cecchetti <marco.cecche...@collabora.com> Date: Mon Feb 29 22:18:23 2016 +0100 tdf#97369/#97587 - Further fix SUMming in the software interpreter When SUMming in the software interpreter involved trailing empty cells, code tried to read beyond numeric array limit. Change-Id: I50c1148e7e79d02bedb02a771df172035112915c Reviewed-on: https://gerrit.libreoffice.org/22791 Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index a785fb6..ad40ccc 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7059,9 +7059,10 @@ void Test::testTdf97587() sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. - std::set<SCROW> emptyCells = {0, 50, 100}; + std::set<SCROW> emptyCells = {0, 100}; for( SCROW i = 0; i < ROW_RANGE; ++i ) { + emptyCells.insert(i + TOTAL_ROWS / 3); emptyCells.insert(i + TOTAL_ROWS); } @@ -7070,7 +7071,7 @@ void Test::testTdf97587() { if( emptyCells.find(i) != emptyCells.end() ) continue; - m_pDoc->SetValue(ScAddress(0, i, 0), 1); + m_pDoc->SetValue(ScAddress(0, i, 0), 1.0); } ScDocument aClipDoc(SCDOCMODE_CLIP); @@ -7098,7 +7099,6 @@ void Test::testTdf97587() double fExpected = ROW_RANGE - k; ASSERT_DOUBLES_EQUAL(fExpected, m_pDoc->GetValue(ScAddress(1,i,0))); } - m_pDoc->DeleteTab(0); } diff --git a/sc/source/core/inc/arraysumfunctor.hxx b/sc/source/core/inc/arraysumfunctor.hxx index 3955fd9..d94bf74 100644 --- a/sc/source/core/inc/arraysumfunctor.hxx +++ b/sc/source/core/inc/arraysumfunctor.hxx @@ -51,12 +51,15 @@ public: if (hasSSE2) { - while (!isAligned<double, 16>(pCurrent)) + while ( i < mnSize && !isAligned<double, 16>(pCurrent)) { fSum += *pCurrent++; i++; } - fSum += executeSSE2(i, pCurrent); + if( i < mnSize ) + { + fSum += executeSSE2(i, pCurrent); + } } else fSum += executeUnrolled(i, pCurrent); diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 6019cc2..279701e 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -3524,7 +3524,7 @@ ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool bTextAsZero) const { return ScMatrix::IterateResult(0.0, 0.0, 0); } - else if (nDataSize > mpToken->GetArrayLength() + mnRowStart) + else if (nDataSize > mpToken->GetArrayLength() - mnRowStart) { nDataSize = mpToken->GetArrayLength() - mnRowStart; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits