diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2017-01-14 00:03:25 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-01-15 19:56:32 +0000 |
commit | 4f6d6d905ffe4e9962ea858d415273df4f5829fd (patch) | |
tree | df0c631fd32a37915b1fe92726f7169de3e3ec42 | |
parent | 91f8766db597e25714be0eab8c69510e19865c04 (diff) |
tdf#50916 Make sure that we don't access aCol out of range
Change-Id: Ib41b474c6ae573ca68614aeff8ca2cda5fd52dbc
Reviewed-on: https://gerrit.libreoffice.org/33061
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/data/document.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index da23524ad344..f486e28139be 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6420,11 +6420,16 @@ bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const bool ScDocument::HasTabNotes(SCTAB nTab) const { - bool hasNotes = false; - for (SCCOL nCol=0; nCol<MAXCOLCOUNT && !hasNotes; ++nCol) - hasNotes = HasColNotes(nCol, nTab); + const ScTable* pTab = FetchTable(nTab); + + if ( !pTab ) + return false; - return hasNotes; + for (SCCOL nCol=0, nColSize = pTab->aCol.size(); nCol < nColSize; ++nCol) + if ( HasColNotes(nCol, nTab) ) + return true; + + return false; } bool ScDocument::HasNotes() const |