summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-05 10:50:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-05 11:31:27 +0200
commit304b3b3910bb472d663baaa789970df55ceeb09e (patch)
tree76db6bd494cef6b75d093d8977756252ec0b1434 /vcl
parent61e8452c62a587b40bf80076642b869cbd1b7ed6 (diff)
Handle GetTextBreak returning -1
I don't know what the root cause is exactly that made at least Mac OS X --enable-dbgutil JunitTest_forms_unoapi start to fail recently, but when nWidth is just 1 (which might be the root of the problem here, but could probably also legitimately be the case) and GetTextWidth returns -1 (which it probably is allowed to do), this would lead to an out-of-bounds OUString::operator[] access at > rtl::OUString::operator[] (this=0x118a04be0, index=-1) at ustring.hxx:421 > com::sun::star::i18n::BreakIterator_Unicode::getLineBreak (this=0x11986f6f8, Text=@0x118a04be0, nStartPos=-2, rLocale=@0x7fbd83821d98, nMinBreakPos=4, hOptions=@0x118a04620) at i18npool/source/breakiterator/breakiterator_unicode.cxx:429 > com::sun::star::i18n::BreakIteratorImpl::getLineBreak (this=0x1112d5c98, Text=@0x118a04be0, nStartPos=-1, rLocale=@0x7fbd83821d98, nMinBreakPos=4, hOptions=@0x118a04620, bOptions=@0x118a045f8) at i18npool/source/breakiterator/breakiteratorImpl.cxx:242 > OutputDevice::ImplGetTextLines (rLineInfo=@0x118a04bb0, nWidth=1, rStr=@0x118a04be0, nStyle=12560, _rLayout=@0x118a04db8) at vcl/source/outdev/text.cxx:527 > OutputDevice::ImplDrawText (this=0x7fbd8302d000, rTargetDevice=@0x7fbd8302d000, rRect=@0x118a05058, rOrigStr=@0x118a04f70, nStyle=12560, pVector=0x0, pDisplayText=0x0, _rLayout=@0x118a04db8) at vcl/source/outdev/text.cxx:1500 > OutputDevice::DrawText (this=0x7fbd8302d000, rRect=@0x118a05058, rOrigStr=@0x118a04f70, nStyle=12560, pVector=0x0, pDisplayText=0x0, _pTextLayout=0x0) at vcl/source/outdev/text.cxx:1754 > sfx2::TitledDockingWindow::Paint (this=0x7fbd8302d000, i_rArea=@0x118a051d0) at sfx2/source/dialog/titledockwin.cxx:218 Change-Id: I95c6027e86b9a608fe9eb05ffb83fb2316c175f2
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/text.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index bb9fbc1ed2d7..af9eb1b0e0e6 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -521,6 +521,10 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
{
const css::lang::Locale& rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
sal_Int32 nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos );
+ if (nSoftBreak == -1)
+ {
+ nSoftBreak = nPos;
+ }
DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" );
css::i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, css::uno::Sequence <css::beans::PropertyValue>(), 1 );
css::i18n::LineBreakUserOptions aUserOptions;