diff options
author | Eike Rathke <erack@redhat.com> | 2013-04-11 15:24:38 +0200 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-04-11 18:02:10 +0000 |
commit | 2f8b34c3777ad8ddc2eabafcbdfa6536360ab7e6 (patch) | |
tree | 63fba91d2839a674540cbe51d7e09645d5bd27a3 | |
parent | 684cc44c28c8bb5abc022e0fab2f579d69adfec5 (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
(cherry picked from commit 58885eda4f15913fc46243dab726632f5904aab5)
Reviewed-on: https://gerrit.libreoffice.org/3339
Reviewed-by: Kohei Yoshida <kohei.yoshida@gmail.com>
Tested-by: Kohei Yoshida <kohei.yoshida@gmail.com>
-rw-r--r-- | sc/source/core/data/dpoutput.cxx | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 2b86a698c846..ea43c5f257d0 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1782,6 +1782,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; |