sc/source/core/tool/interpr1.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 4a1fad2147186f6b150cd10519dda541a4d2e6c0
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Sat Apr 29 18:59:30 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed May 3 12:17:39 2023 +0200

    Resolves: tdf#119659 Check found position for result vector
    
    Change-Id: Idc454462c47b6c7b7b7cb6c86b08650d059221c7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151186
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 6b6b83b43fcae13e30a9ca67b421187a5e0d7142)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151192
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index eb77bf07e514..94964b1a081c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7063,7 +7063,8 @@ void ScInterpreter::ScLookup()
         if (pResMat)
         {
             VectorMatrixAccessor aResMatAcc(*pResMat, bVertical);
-            // result array is matrix.
+            // Result array is matrix.
+            // Note this does not replicate the other dimension.
             if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount())
             {
                 PushNA();
@@ -7197,6 +7198,12 @@ void ScInterpreter::ScLookup()
     {
         VectorMatrixAccessor aResMatAcc(*pResMat, bVertical);
         // Use the matrix result array.
+        // Note this does not replicate the other dimension.
+        if (o3tl::make_unsigned(nDelta) >= aResMatAcc.GetElementCount())
+        {
+            PushNA();
+            return;
+        }
         if (aResMatAcc.IsValue(nDelta))
             PushDouble(aResMatAcc.GetDouble(nDelta));
         else

Reply via email to