summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-11-29 16:07:40 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-11-29 16:07:40 -0500
commit0723039f40ca98a5e80ff8d1f9981428becc03b4 (patch)
treee5e8e1b087a143c0be8dac76b7380c88695028ee /sc
parent54c47a6dc8e66eb7e7043e5ce78c1b8a2fda50ac (diff)
Fixed use of incorrect integer type during import of outlines.
I was supposed to use SCSIZE to store column / row position but was incorrectly using sal_uInt8. This caused import of outlines from Excel document to entirely get screwed when the outline positions were > 255, and it was understandably so. :-P (fdo#31833)
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/exctools.cxx13
-rw-r--r--sc/source/filter/inc/otlnbuff.hxx1
2 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index e638236e34c8..5f585e0b6293 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -97,6 +97,7 @@ RootData::~RootData()
XclImpOutlineBuffer::XclImpOutlineBuffer( SCSIZE nNewSize ) :
maLevels(0, nNewSize, 0),
mpOutlineArray(NULL),
+ mnEndPos(nNewSize),
mnMaxLevel(0),
mbButtonAfter(true)
{
@@ -125,12 +126,18 @@ void XclImpOutlineBuffer::MakeScOutline()
if (!mpOutlineArray)
return;
- ::std::vector<sal_uInt8> aOutlineStack;
+ ::std::vector<SCSIZE> aOutlineStack;
aOutlineStack.reserve(mnMaxLevel);
- OutlineLevels::const_iterator itr = maLevels.begin(), itr_end = maLevels.end();
- for (; itr != itr_end; ++itr)
+ OutlineLevels::const_iterator itr = maLevels.begin(), itrEnd = maLevels.end();
+ for (; itr != itrEnd; ++itr)
{
SCSIZE nPos = itr->first;
+ if (nPos >= mnEndPos)
+ {
+ // Don't go beyond the max allowed position.
+ DBG_ASSERT(aOutlineStack.empty(), "XclImpOutlineBuffer::MakeScOutline: outline stack not empty but expected to be.");
+ break;
+ }
sal_uInt8 nLevel = itr->second;
sal_uInt8 nCurLevel = static_cast<sal_uInt8>(aOutlineStack.size());
if (nLevel > nCurLevel)
diff --git a/sc/source/filter/inc/otlnbuff.hxx b/sc/source/filter/inc/otlnbuff.hxx
index 71e94d9985a9..9ed84056f182 100644
--- a/sc/source/filter/inc/otlnbuff.hxx
+++ b/sc/source/filter/inc/otlnbuff.hxx
@@ -52,6 +52,7 @@ private:
OutlineLevels maLevels;
::std::set<SCSIZE> maCollapsedPosSet;
ScOutlineArray* mpOutlineArray;
+ SCSIZE mnEndPos;
sal_uInt8 mnMaxLevel;
bool mbButtonAfter:1;
};