[Libreoffice-commits] .: sc/source

Eike Rathke erack at kemper.freedesktop.org
Mon Jan 23 06:46:43 PST 2012


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

New commits:
commit a7769e27849b74102e11540d7753576528323114
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 cda83d3..b6492dd 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:
@@ -1541,7 +1543,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