[Libreoffice-commits] .: sc/source

Muthu Subramanian sumuthu at kemper.freedesktop.org
Mon Jun 6 06:14:53 PDT 2011


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

New commits:
commit f667843a389e77f3ba3292b4cf57a2eb510a397a
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).

diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 57e7353..60a0ee4 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