diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-04-20 17:50:06 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-04-27 14:00:41 +0200 |
commit | e6ad7c39b88246884597cd0027f1fad55072b3b2 (patch) | |
tree | c1533c15d69b6d49dd25962a90f74402d831c86c | |
parent | 6ea18bab37b98cfbed2efbbaea763a842bbcf7f1 (diff) |
Do not attempt to copy beyond end of OUString
m_pDropCapsField case could probably be simplified, but I don't
have enough background and prefer to stay on the safe side.
Change-Id: I88a604a2a984c7a5c96741164f1903b14d585005
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 6449a859eafa..e5b7b997f49a 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -702,7 +702,7 @@ IMPL_LINK( SwDropCapsPage, ModifyHdl, Edit *, pEdit ) if (!sEdit.isEmpty() && !sPreview.startsWith(sEdit)) { - sPreview = sEdit.copy(0, sPreview.getLength()); + sPreview = sEdit.copy(0, std::min(sEdit.getLength(), sPreview.getLength())); bSetText = false; } @@ -781,7 +781,10 @@ void SwDropCapsPage::FillSet( SfxItemSet &rSet ) OUString sText(m_pTextEdit->GetText()); if (!m_pWholeWordCB->IsChecked()) - sText = sText.copy( 0, m_pDropCapsField->GetValue()); + { + sText = sText.copy( 0, std::max<sal_Int32>( + sText.getLength(), m_pDropCapsField->GetValue()) ); + } SfxStringItem aStr(FN_PARAM_1, sText); rSet.Put( aStr ); |