summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-05-13 12:18:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-14 08:47:56 +0200
commit10bacbcc5ed91a195c74140e05b953f62e46afe7 (patch)
tree66b2cf5fec2d7496d8131339c628789c5b1d6bd8 /vcl
parent2a60c2b7d0f126841420aa6b23dde5b9a795d4fa (diff)
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@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@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/edit/texteng.cxx2
1 files changed, 1 insertions, 1 deletions
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;