[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Tue Oct 29 12:12:02 CET 2013


 sw/source/core/text/portxt.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 47690627565bec866ea2de74b5504160479cff74
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Oct 29 10:58:18 2013 +0000

    Resolves: fdo#69510 don't access beyond end of string
    
    Change-Id: Ib5d60159ad75791371a7805ef8e211a4010d7608

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 01afab6..ff20cc1 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;


More information about the Libreoffice-commits mailing list