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

Stephan Bergmann sbergman at redhat.com
Thu Dec 8 11:10:04 UTC 2016


 sc/source/ui/view/gridwin.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e2227a4f4894612a9eee7deea44c9632d50314a4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 8 12:08:12 2016 +0100

    Avoid using uninitialized nCol, nRow
    
    ...when aIter.GetNext returned null; found by Valgrind'ing JunitTest_sc_unoapi_4
    
    Change-Id: Ia94928f78d0512755ee6d788b0470dea34b2a9a7

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 3fd2933..81f9b9e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5518,12 +5518,12 @@ bool ScGridWindow::ContinueOnlineSpelling()
     SCROW nRow;
     ScRefCellValue* pCell = aIter.GetNext(nCol, nRow);
     SCROW nEndRow = 0;
-    bool bHidden = pDoc->RowHidden(nRow, nTab, nullptr, &nEndRow);
+    bool bHidden = pCell && pDoc->RowHidden(nRow, nTab, nullptr, &nEndRow);
     bool bSkip = pCell && (nRow < mpSpellCheckCxt->maPos.mnRow || bHidden);
     while (bSkip)
     {
         pCell = aIter.GetNext(nCol, nRow);
-        if (nRow > nEndRow)
+        if (pCell && nRow > nEndRow)
         {
             bHidden = pDoc->RowHidden(nRow, nTab, nullptr, &nEndRow);
         }
@@ -5531,12 +5531,12 @@ bool ScGridWindow::ContinueOnlineSpelling()
     }
 
     SCCOL nEndCol = 0;
-    bHidden = pDoc->ColHidden(nCol, nTab, nullptr, &nEndCol);
+    bHidden = pCell && pDoc->ColHidden(nCol, nTab, nullptr, &nEndCol);
     bSkip = pCell && (nCol < mpSpellCheckCxt->maPos.mnCol || bHidden);
     while (bSkip)
     {
         pCell = aIter.GetNext(nCol, nRow);
-        if (nCol > nEndCol)
+        if (pCell && nCol > nEndCol)
         {
             bHidden = pDoc->ColHidden(nCol, nTab, nullptr, &nEndCol);
         }


More information about the Libreoffice-commits mailing list