[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/source

Caolán McNamara caolanm at redhat.com
Tue Oct 29 13:16:54 CET 2013


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

New commits:
commit 66edf3c164176180c15dc768ce2b4518a9178183
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
    (cherry picked from commit 47690627565bec866ea2de74b5504160479cff74)
    Reviewed-on: https://gerrit.libreoffice.org/6472
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 7dff0bd..fd04016 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -160,7 +160,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