summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2024-11-05 09:41:16 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2024-11-05 17:49:25 +0100
commite0521498bcde9235ae5b20b4a83a1c37fb91574d (patch)
treed6b9dd6e0a4c023b53538d6542983269e8a9382d
parentad3f929a738292a519128192293c92bd5f96f025 (diff)
Related: tdf#163736 - sc: Fix wrong nSearchMode (0) in vlookup
For VLOOKUP nSearchMode was 0. So static_cast<SearchMode>(nSearchMode) casts to a value which does not exist in SearchMode enum. That gives an "undefined behavior". Better to use the valid default forward search. (1) Change-Id: I1757b43073e13638704b96c4a9d036cb9a21e470 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176043 Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Tested-by: Jenkins
-rw-r--r--sc/source/core/tool/interpr1.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 3f7ab08e712c..2f5656769ced 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -7825,7 +7825,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup)
else
{
ScAddress aResultPos( nCol1, nRow1, nTab1);
- bFound = LookupQueryWithCache( aResultPos, aParam, refData, 0, SC_OPCODE_V_LOOKUP );
+ bFound = LookupQueryWithCache( aResultPos, aParam, refData, 1 /*searchfwd*/, SC_OPCODE_V_LOOKUP );
nRow = aResultPos.Row();
nCol = nSpIndex;
}