diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-09 11:44:51 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-05-11 03:07:38 -0700 |
commit | f89b4a7de1669c75e33748dae438c7c6c2b6524e (patch) | |
tree | e88bf1f1a055a5defebd275d3e1741efefc35599 | |
parent | 2535f5a60cec6c395690c516921f1780c4e300af (diff) |
fdo#77806: Check the boundaries before accessing an array....
Change-Id: I0878f734599f566cde83183947cd7613c0f8d5c6
(cherry picked from commit a45973a90625f4b9e0f603154194f357ff2418d4)
Reviewed-on: https://gerrit.libreoffice.org/9292
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/data/document.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 8c69412d1beb..47164be8c49f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6113,14 +6113,30 @@ bool ScDocument::HasNote(const ScAddress& rPos) const { return HasNote(rPos.Col(), rPos.Row(), rPos.Tab()); } + bool ScDocument::HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab) const { - const ScPostIt* pNote = maTabs[nTab]->aCol[nCol].GetCellNote(nRow); + if (!ValidColRow(nCol, nRow)) + return false; + + const ScTable* pTab = FetchTable(nTab); + if (!pTab) + return false; + + const ScPostIt* pNote = pTab->aCol[nCol].GetCellNote(nRow); return pNote != NULL; } + bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const { - return maTabs[nTab]->aCol[nCol].HasCellNotes(); + if (!ValidCol(nCol)) + return false; + + const ScTable* pTab = FetchTable(nTab); + if (!pTab) + return false; + + return pTab->aCol[nCol].HasCellNotes(); } bool ScDocument::HasTabNotes(SCTAB nTab) const |