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

New commits:
commit ca0b6c3e223273d75dcd90f1c419e37abf6311e6
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue May 27 15:40:55 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue May 27 18:12:56 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/+/185916
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index 26804b33d3d1..c4f52ad07c85 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -460,7 +460,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