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

Kohei Yoshida kohei.yoshida at gmail.com
Tue Feb 5 12:24:41 PST 2013


 sc/source/core/tool/reffind.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 6ed233b26222815f68dfc220cd1e692a11cd5af6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Feb 5 15:23:44 2013 -0500

    fdo#39135: Prevent integer overflow & update the character during loop.
    
    These two errors in the code contributed to the reported bug.  Let's
    fix them.
    
    Change-Id: If82a1bd4d1e27145b48e722b30388cc9dc4a8a6e

diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx
index 2fe76fc..c4621f0 100644
--- a/sc/source/core/tool/reffind.cxx
+++ b/sc/source/core/tool/reffind.cxx
@@ -155,15 +155,20 @@ void ExpandToTextR1C1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartP
                     if (c == '\'')
                         break;
                 }
+                if (rStartPos == 0)
+                    break;
             }
             else if (c == ']')
             {
                 // Skip until the opening braket.
                 for (--rStartPos; rStartPos > 0; --rStartPos)
                 {
+                    c = p[rStartPos];
                     if (c == '[')
                         break;
                 }
+                if (rStartPos == 0)
+                    break;
             }
             else if (!IsText(c))
             {


More information about the Libreoffice-commits mailing list