comphelper/source/streaming/memorystream.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 07eaaeb76493b91520ef0062bf9601a36a9b6b0c
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Jul 18 13:14:44 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Mon Jul 18 15:06:46 2022 +0200

    nNewSize is guaranteed to be non-negative here
    
    Change-Id: Idb427a0bd3bae94f056d3253682a024169b5288f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137172
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/comphelper/source/streaming/memorystream.cxx 
b/comphelper/source/streaming/memorystream.cxx
index 58380eb60d1e..f5cac50cc1ca 100644
--- a/comphelper/source/streaming/memorystream.cxx
+++ b/comphelper/source/streaming/memorystream.cxx
@@ -217,7 +217,7 @@ void SAL_CALL UNOMemoryStream::writeBytes( const Sequence< 
sal_Int8 >& aData )
         throw IOException("this implementation does not support more than 
2GB!", static_cast<OWeakObject*>(this) );
     }
 
-    if( static_cast< sal_Int32 >( nNewSize ) > static_cast< sal_Int32 >( 
maData.size() ) )
+    if( o3tl::make_unsigned( nNewSize ) > maData.size() )
         maData.resize( nNewSize );
 
     sal_Int8* pData = &(*maData.begin());
@@ -240,7 +240,7 @@ void UNOMemoryStream::writeBytes( const sal_Int8* pInData, 
sal_Int32 nBytesToWri
         throw IOException("this implementation does not support more than 
2GB!", static_cast<OWeakObject*>(this) );
     }
 
-    if( static_cast< sal_Int32 >( nNewSize ) > static_cast< sal_Int32 >( 
maData.size() ) )
+    if( o3tl::make_unsigned( nNewSize ) > maData.size() )
         maData.resize( nNewSize );
 
     sal_Int8* pData = &(*maData.begin());

Reply via email to