summaryrefslogtreecommitdiff
path: root/sc/source/core/data/dpoutput.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-04-11 15:24:38 +0200
committerEike Rathke <erack@redhat.com>2013-04-11 15:30:06 +0200
commit58885eda4f15913fc46243dab726632f5904aab5 (patch)
treedf46c1079b6cb8ab2b3da2f0fe960207341b8972 /sc/source/core/data/dpoutput.cxx
parent76bf4dae2f992e013b0cbbfa7dbe5cc692fa9f83 (diff)
prevent out of bounds vector access in ooo62493-1.xls recalculation
The document https://issues.apache.org/ooo/attachment.cgi?id=34418 attached to https://issues.apache.org/ooo/show_bug.cgi?id=62493 crashes in a dbgutil build due to an invalid subtotal count that leads to an out of bounds access in a vector, in this case with offset -1 This fixes the symptom, not the cause why the subtotal count would be wrong. Change-Id: If96c2eadba8753ea3e3166db0a81441818c89b2d
Diffstat (limited to 'sc/source/core/data/dpoutput.cxx')
-rw-r--r--sc/source/core/data/dpoutput.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 3cd83694a7f7..4964a2136452 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -1812,6 +1812,8 @@ void lcl_StripSubTotals( std::vector<bool>& rResult, const std::vector<sal_Int32
// if a subtotal is included, clear the result flag for the columns/rows that the subtotal includes
sal_Int32 nStart = nPos - rSubtotal[nPos];
OSL_ENSURE( nStart >= 0, "invalid subtotal count" );
+ if (nStart < 0)
+ nStart = 0;
for (sal_Int32 nPrev = nStart; nPrev < nPos; nPrev++)
rResult[nPrev] = false;