[Libreoffice-commits] core.git: sc/source

Bartosz Kosiorek gang65 at poczta.onet.pl
Sun Jan 15 19:56:53 UTC 2017


 sc/source/core/data/document.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 4f6d6d905ffe4e9962ea858d415273df4f5829fd
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Sat Jan 14 00:03:25 2017 +0100

    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 at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index da23524..f486e28 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


More information about the Libreoffice-commits mailing list