[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source
Marco Cecchetti
marco.cecchetti at collabora.com
Tue Mar 1 10:15:32 UTC 2016
sc/source/core/inc/arraysumfunctor.hxx | 7 +++++--
sc/source/core/tool/scmatrix.cxx | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
New commits:
commit 9b7f72203f2b9f6b95d927c695f7f48b86b251ee
Author: Marco Cecchetti <marco.cecchetti at 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
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 6018ca1..e2dde4e 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -3401,7 +3401,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;
}
More information about the Libreoffice-commits
mailing list