sw/source/uibase/docvw/edtwin2.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c32cc77f24ae6572bab5e5d8c44efdc8540da926
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue May 27 15:40:55 2025 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri May 30 12:54:14 2025 +0200

    if nTextLen is 0 this loop never ends
    
    seen in crash report as:
    
    [ admin ] ERR  Aborted resource consuming doc | wsd/AdminModel.cpp:802
    
    program/libuno_sal.so.3
            void rtl::str::stringbuffer_insert<_rtl_uString, 
char16_t>(_rtl_uString**, int*, int, char16_t const*, int)
                    sal/rtl/strtmpl.hxx:1262
    program/../program/libswlo.so
            SwEditWin::RequestHelp(HelpEvent const&)
                    sw/source/uibase/docvw/edtwin2.cxx:464
    program/libmergedlo.so
            (anonymous namespace)::LOKPostAsyncEvent(void*, void*)
                    sfx2/source/view/lokhelper.cxx:1203
    program/../program/libswlo.so
            SwXTextDocument::postMouseEvent(int, int, int, int, int, int)
                    include/rtl/ref.hxx:125
    program/libmergedlo.so
            doc_postMouseEvent
                    desktop/source/lib/init.cxx:5595
    
    Change-Id: I43b33ec0ac29ea1a8bb02ec58d3191b0b8d3d7e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185926
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-by: Sahil Gautam <sahil.gautam.ext...@allotropia.de>

diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index 11b3b3d4d9d1..b776c8ddc483 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -459,7 +459,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
                         OUStringBuffer sStrBuffer(sName);
                         sal_Int32 nTextLen = sText.getLength();
                         sal_Int32 nNameLen = sName.getLength();
-                        if (nNameLen > nTextLen)
+                        if (nTextLen > 0 && nNameLen > nTextLen)
                         {
                             for (sal_Int32 i = nTextLen - 1; i < nNameLen; i 
+= nTextLen)
                                 sStrBuffer.insert(i + 1, std::u16string_view(u"
"));

Reply via email to