sc/source/core/tool/interpr1.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 72b027af1148ef57ee3c167f5a9e768831b61d43
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Tue Nov 5 09:41:16 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Nov 6 20:01:34 2024 +0100

    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.ext...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit e0521498bcde9235ae5b20b4a83a1c37fb91574d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176062
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 79a91ed5ed6b..e8ccc4570acb 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;
         }

Reply via email to