diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-07-18 13:14:44 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-07-18 15:06:46 +0200 |
commit | 07eaaeb76493b91520ef0062bf9601a36a9b6b0c (patch) | |
tree | fca057a30a320a1eda57f838b7f74f6b168d501f /comphelper | |
parent | fd2e907e448991e5c8b54acbe7e31bff24c8e875 (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/streaming/memorystream.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
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()); |