summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-29 10:58:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-10-29 11:11:33 +0000
commit47690627565bec866ea2de74b5504160479cff74 (patch)
tree845df648db88b13e992065595f75ea5a4a91dfe3 /sw
parentef439702fa80ed8730d885aeded60dbf0bc5d264 (diff)
Resolves: fdo#69510 don't access beyond end of string
Change-Id: Ib5d60159ad75791371a7805ef8e211a4010d7608
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/portxt.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 01afab67d721..ff20cc1fe98b 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -161,7 +161,8 @@ static sal_Int32 lcl_AddSpace( const SwTxtSizeInfo &rInf, const OUString* pStr,
if ( bDoNotAddSpace )
return nCnt;
- for ( ; nPos < nEnd; ++nPos )
+ sal_Int32 nTxtEnd = std::min(nEnd, pStr->getLength());
+ for ( ; nPos < nTxtEnd; ++nPos )
{
if( CH_BLANK == (*pStr)[ nPos ] )
++nCnt;