Hi Olivier,

Good catch for this.

On Wed, 2011-08-10 at 18:06 -0300, Olivier Hallot wrote:

> I had to add this patch to prevent the table boudaries crash issue
> that raised when one use the By property for GoLeftSel and GoRightSel.

I would put the boundary check before incrementing and decrementing the
column / row position, to be consistent with the previous if statement
which checks the next position before moving the position, not after.

So, attached is my proposed change.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kohei.yosh...@suse.com>
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 0ad18a4..995d6b5 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -92,6 +92,8 @@ void moveCursorByProtRule(
             {
                 if (!isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, bSelectUnlocked))
                     break;
+                if (rCol+1 > MAXCOL)
+                    break;
                 ++rCol;
             }
         }
@@ -105,6 +107,8 @@ void moveCursorByProtRule(
             {
                 if (!isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, bSelectUnlocked))
                     break;
+                if (rCol-1 < 0)
+                    break;
                 --rCol;
             }
         }
@@ -118,6 +122,8 @@ void moveCursorByProtRule(
             {
                 if (!isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, bSelectUnlocked))
                     break;
+                if (rRow+1 > MAXROW)
+                    break;
                 ++rRow;
             }
         }
@@ -131,6 +137,8 @@ void moveCursorByProtRule(
             {
                 if (!isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, bSelectUnlocked))
                     break;
+                if (rRow-1 < 0)
+                    break;
                 --rRow;
             }
         }
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to