[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Fridrich Strba fridrich at kemper.freedesktop.org
Tue Jul 19 05:45:38 PDT 2011


 sc/source/filter/excel/xestream.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit cf509b9aa79a3429caea80d933f7642397f8aab5
Author: Muthu Subramanian <sumuthu at novell.com>
Date:   Mon Jun 6 18:56:54 2011 +0530

    Out-of-bounds array access fix. (Thanks to Fridrich too).
    
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>

diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 319dfe1..5108c3c 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -861,10 +861,10 @@ OUString XclXmlUtils::ToOUString( const char* s )
 
 OUString XclXmlUtils::ToOUString( const ScfUInt16Vec& rBuf, sal_Int32 nStart, sal_Int32 nLength )
 {
-    if( nLength == -1 )
-        nLength = rBuf.size();
+    if( nLength == -1 || ( nLength > (rBuf.size() - nStart) ) )
+        nLength = (rBuf.size() - nStart);
 
-    return OUString( &rBuf[nStart], nLength );
+    return (nLength > 0) ? OUString( &rBuf[nStart], nLength ) : OUString();
 }
 
 OUString XclXmlUtils::ToOUString( const String& s )


More information about the Libreoffice-commits mailing list