Kaydet (Commit) bec0ad46 authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 PVS: V1028 fix unexpected integer overflow

V1028 Possible overflow. Consider casting arguments of the operator
      to the type instead of casting its result.

V547 Expression 'nNewSize > ((sal_Int32) 0x7FFFFFFF)' is always false.

Change-Id: I7107b162d88c9d3f97019effcac1f9cfab52a66c
Reviewed-on: https://gerrit.libreoffice.org/62846Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 8537d88d
...@@ -190,7 +190,7 @@ void SAL_CALL UNOMemoryStream::writeBytes( const Sequence< sal_Int8 >& aData ) ...@@ -190,7 +190,7 @@ void SAL_CALL UNOMemoryStream::writeBytes( const Sequence< sal_Int8 >& aData )
const sal_Int32 nBytesToWrite( aData.getLength() ); const sal_Int32 nBytesToWrite( aData.getLength() );
if( nBytesToWrite ) if( nBytesToWrite )
{ {
sal_Int64 nNewSize = static_cast< sal_Int64 >( mnCursor + nBytesToWrite ); sal_Int64 nNewSize = static_cast<sal_Int64>(mnCursor) + nBytesToWrite;
if( nNewSize > SAL_MAX_INT32 ) if( nNewSize > SAL_MAX_INT32 )
{ {
OSL_ASSERT(false); OSL_ASSERT(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment