Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


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.yoshida@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;
             }
         }

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.