[Libreoffice-commits] core.git: vcl/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Fri May 14 06:48:32 UTC 2021


 vcl/source/edit/texteng.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 10bacbcc5ed91a195c74140e05b953f62e46afe7
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Thu May 13 12:18:02 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 14 08:47:56 2021 +0200

    Fix assertion in vcl/texteng
    
    Insert macro from https://bugs.documentfoundation.org/show_bug.cgi?id=94024 and start
    I got this bt:
    0  __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
    1  0x00007f39e2b61537 in __GI_abort () at abort.c:79
    2  0x00007f39e2b6140f in __assert_fail_base
       (fmt=0x7f39e2cca128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f39db29740e "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())", file=0x7f39db27f997 "/home/julien/lo/libreoffice/include/rtl/ustring.hxx", line=794, function=<optimized out>) at assert.c:92
    3  0x00007f39e2b70662 in __GI___assert_fail
       (assertion=0x7f39db29740e "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())", file=0x7f39db27f997 "/home/julien/lo/libreoffice/include/rtl/ustring.hxx", line=794, function=0x7f39db2bada5 "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:101
    4  0x00007f39da1fe3c4 in rtl::OUString::operator[](int) const (this=0x846da80, index=-1) at include/rtl/ustring.hxx:794
    5  0x00007f39da59acdc in TextEngine::GetWord(TextPaM const&, TextPaM*, TextPaM*) (this=0x8901e80, rCursorPos=..., pStartOfWord=0x7ffd1f0b7360, pEndOfWord=0x0) at vcl/source/edit/texteng.cxx:2375
    6  0x00007f39c4ac5c5c in basctl::EditorWindow::RequestHelp(HelpEvent const&) (this=0x8581060, rHEvt=...) at basctl/source/basicide/baside2b.cxx:370
    7  0x00007f39da3b8f91 in ImplHandleMouseHelpRequest(vcl::Window*, Point const&) (pChild=0x8581060, rMousePos=Point = {...}) at vcl/source/window/winproc.cxx:181
    
    (gdb) frame 4
    4  0x00007f39da1fe3c4 in rtl::OUString::operator[] (this=0x846da80, index=-1) at include/rtl/ustring.hxx:794
    794             assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
    (gdb) p this
    $1 = (const rtl::OUString *) 0x846da80
    (gdb) p *this
    $2 = "\t\t"
    (gdb) frame 5
    5  0x00007f39da59acdc in TextEngine::GetWord (this=0x8901e80, rCursorPos=..., pStartOfWord=0x7ffd1f0b7360, pEndOfWord=0x0) at vcl/source/edit/texteng.cxx:2375
    2375            if (aBoundary.endPos < pNode->GetText().getLength() && u_charType(pNode->GetText()[aBoundary.endPos - 1]) == U_CONNECTOR_PUNCTUATION)
    (gdb) p aBoundary.endPos
    $3 = 0
    (gdb) p pNode->GetText()
    $4 = "\t\t"
    (gdb) p pNode->GetText().getLength()
    $5 = 2
    
    Change-Id: Ic94362b26cb0ebb0975c42fe5a31724ff485aad0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115546
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 1959151ffee1..aa4940e33eba 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2372,7 +2372,7 @@ OUString TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord,
                     GetLocale(), css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, true).startPos);
         }
         // tdf#57879 - expand selection to the right to include connector punctuations and search for additional word boundaries
-        if (aBoundary.endPos < pNode->GetText().getLength() && u_charType(pNode->GetText()[aBoundary.endPos - 1]) == U_CONNECTOR_PUNCTUATION)
+        if (aBoundary.endPos > 0 && aBoundary.endPos < pNode->GetText().getLength() && u_charType(pNode->GetText()[aBoundary.endPos - 1]) == U_CONNECTOR_PUNCTUATION)
         {
             aBoundary.endPos = xBI->getWordBoundary(pNode->GetText(), aBoundary.endPos,
                 GetLocale(), css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, true).endPos;


More information about the Libreoffice-commits mailing list