summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2023-04-29 18:59:30 +0200
committerAndras Timar <andras.timar@collabora.com>2023-05-13 20:05:28 +0200
commitcc6edc05f32ba5dc81d0a9e4bc93130826846798 (patch)
tree19d90c6de178b92d8922e9a07cabb25ab0ab3537 /sc
parent705588547ff262a038a4203efbf641713a6b67b3 (diff)
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 <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 89e725dc3236f6f8ad226adf6508f7fc753b5572) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151190 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr1.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index ac0fb22b6231..b833e3f48f24 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7072,7 +7072,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();
@@ -7206,6 +7207,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