[Libreoffice-commits] core.git: include/rtl

Matthew J. Francis mjay.francis at gmail.com
Mon Oct 20 00:06:22 PDT 2014


 include/rtl/strbuf.hxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 8091cf383a122f2348d6e25df90fc26579fe6ef7
Author: Matthew J. Francis <mjay.francis at gmail.com>
Date:   Fri Oct 17 20:48:08 2014 +0800

    Increase assert coverage of OStringBuffer arguments
    
    Change-Id: Ifd3c9919ef104909efa8964e7a0cb5e723e3331d
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index b8d1d9d..1bfe640 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -491,7 +491,7 @@ public:
      */
     OStringBuffer & append( const sal_Char * str, sal_Int32 len)
     {
-        // insert behind the last character
+        assert( len >= 0 );
         rtl_stringbuffer_insert( &pData, &nCapacity, getLength(), str, len );
         return *this;
     }
@@ -729,7 +729,8 @@ public:
      */
     OStringBuffer & insert( sal_Int32 offset, const sal_Char * str, sal_Int32 len)
     {
-        // insert behind the last character
+        assert( offset >= 0 && offset <= pData->length );
+        assert( len >= 0 );
         rtl_stringbuffer_insert( &pData, &nCapacity, offset, str, len );
         return *this;
     }
@@ -911,6 +912,8 @@ public:
      */
     OStringBuffer & remove( sal_Int32 start, sal_Int32 len )
     {
+        assert( start >= 0 && start <= pData->length );
+        assert( len >= 0 );
         rtl_stringbuffer_remove( &pData, start, len );
         return *this;
     }


More information about the Libreoffice-commits mailing list