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

New commits:
commit 46708d87d32e99a7db26f3325565d52e2df2a126
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Jun 22 19:56:15 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Jun 24 11:01:08 2022 +0200

    crashtesting: assert in rtl_uString_iterateCodePoints with 
forum-en-32401.ods
    
    probably since:
    
    commit 78b7e5f76e72647e0cab662ad2c9342d4538704f
    Date:   Thu Nov 23 18:21:19 2017 +0100
    
        tdf#97198 Make Calc function SEARCH work with UniCode non-BMP 
characters.
    
    Change-Id: I538c034820e606ba4397f42567dd3087f14129fa
    (cherry picked from commit 05299b4205fa0960c3b2ed55a8c4963ee76238be)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136325
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0b3592976a71..4badca5e1483 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9046,12 +9046,12 @@ void ScInterpreter::ScFind()
         {
             sal_Int32 nIdx = 0;
             nCnt = 0;
-            while ( nIdx <= nPos )
+            while ( nIdx < nPos )
             {
                 sStr.iterateCodePoints( &nIdx );
                 ++nCnt;
             }
-            PushDouble( static_cast<double>(nCnt) );
+            PushDouble( static_cast<double>(nCnt + 1) );
         }
     }
 }
@@ -9445,12 +9445,12 @@ void ScInterpreter::ScSearch()
         {
             sal_Int32 nIdx = 0;
             sal_Int32 nCnt = 0;
-            while ( nIdx <= nPos )
+            while ( nIdx < nPos )
             {
                 sStr.iterateCodePoints( &nIdx );
                 ++nCnt;
             }
-            PushDouble( static_cast<double>(nCnt) );
+            PushDouble( static_cast<double>(nCnt + 1) );
         }
     }
 }

Reply via email to