[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jan 23 08:17:32 PST 2012


 sc/source/core/tool/interpr4.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 9faf077b85098436ac29b9369bfc7d8a9286fbd3
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jan 23 15:43:50 2012 +0100

    resolved rhbz#783556 crash in ScMatrix::GetDimensons() from ScInterpreter
    
    * Interpreter tried to access a nonexistent matrix for external reference.
    * In ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat) set error for
      unexpected conditions. In caller or descendants check for error or presence
      of ScMatrix.

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 07ff54b..424c713 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1285,6 +1285,8 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef()
                 pMat = PopMatrix();
             else
                 PopExternalDoubleRef(pMat);
+            if (nGlobalError)
+                break;
             return new ScDBExternalRange(pDok, pMat);
         }
         default:
@@ -1535,7 +1537,14 @@ void ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat)
     // references, which means the array should only contain a
     // single matrix token.
     ScToken* p = static_cast<ScToken*>(pArray->First());
-    rMat = p->GetMatrix();
+    if (!p || p->GetType() != svMatrix)
+        SetError( errIllegalParameter);
+    else
+    {
+        rMat = p->GetMatrix();
+        if (!rMat)
+            SetError( errUnknownVariable);
+    }
 }
 
 void ScInterpreter::GetExternalDoubleRef(


More information about the Libreoffice-commits mailing list