From efc4d6b83fad337e8bee87d87387028d687934de Mon Sep 17 00:00:00 2001 From: Stephan Bergmann <sbergman@redhat.com> Date: Thu, 7 Mar 2013 17:49:41 +0100 Subject: Do not call OUStringBuffer::copy with bad argument Change-Id: I7cb6e2343486ff9864c44d061fc38c1203791988 --- vcl/source/control/field2.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index c6cc613ab9d8..c86ef11bf27d 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -2208,7 +2208,8 @@ static sal_Bool ImplIsValidTimePortion( sal_Bool _bSkipInvalidCharacters, const static sal_Bool ImplCutTimePortion( OUStringBuffer& _rStr, xub_StrLen _nSepPos, sal_Bool _bSkipInvalidCharacters, short* _pPortion ) { OUString sPortion(_rStr.getStr(), _nSepPos ); - _rStr = _rStr.copy( _nSepPos + 1 ); + _rStr = _nSepPos < _rStr.getLength() + ? _rStr.copy( _nSepPos + 1 ) : OUStringBuffer(); if ( !ImplIsValidTimePortion( _bSkipInvalidCharacters, sPortion ) ) return sal_False; -- cgit