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>
This commit is contained in:
Bartosz Kosiorek
2017-01-14 00:03:25 +01:00
committed by Markus Mohrhard
parent 91f8766db5
commit 4f6d6d905f

View File

@@ -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);
return hasNotes;
if ( !pTab )
return false;
for (SCCOL nCol=0, nColSize = pTab->aCol.size(); nCol < nColSize; ++nCol)
if ( HasColNotes(nCol, nTab) )
return true;
return false;
}
bool ScDocument::HasNotes() const