[Libreoffice-commits] core.git: sal/inc

Stephan Bergmann sbergman at redhat.com
Thu Mar 7 23:22:52 PST 2013


 sal/inc/rtl/ustrbuf.hxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit b62541a083158cf1d30337ba5e751c1cbd2c649e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Mar 8 08:22:27 2013 +0100

    Assert OUStringBuffer::copy preconditions
    
    Change-Id: I46ccba35be6695dba14721303b5eb52f69fc3dfa

diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 8a50946..8e4ca1d 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -1322,8 +1322,10 @@ public:
     */
     OUStringBuffer copy( sal_Int32 beginIndex ) const SAL_THROW(())
     {
+        assert(beginIndex >= 0 && beginIndex <= getLength());
         return copy( beginIndex, getLength() - beginIndex );
     }
+
     /**
       Returns a new string buffer that is a substring of this string.
 
@@ -1339,6 +1341,8 @@ public:
     */
     OUStringBuffer copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
     {
+        assert(beginIndex >= 0 && beginIndex <= getLength());
+        assert(count >= 0 && count <= getLength() - beginIndex);
         rtl_uString *pNew = 0;
         rtl_uStringbuffer_newFromStr_WithLength( &pNew, getStr() + beginIndex, count );
         return OUStringBuffer( pNew, count + 16 );


More information about the Libreoffice-commits mailing list