[Libreoffice-commits] core.git: comphelper/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 5 15:44:48 UTC 2018


 comphelper/source/streaming/memorystream.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bec0ad463a39a9d66fc8ab613d0a26f0fa59b00d
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Nov 4 17:03:24 2018 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Nov 5 16:43:50 2018 +0100

    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/62846
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx
index 39b2fa0a63c5..77cb69251d5e 100644
--- a/comphelper/source/streaming/memorystream.cxx
+++ b/comphelper/source/streaming/memorystream.cxx
@@ -190,7 +190,7 @@ void SAL_CALL UNOMemoryStream::writeBytes( const Sequence< sal_Int8 >& aData )
     const sal_Int32 nBytesToWrite( aData.getLength() );
     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 )
         {
             OSL_ASSERT(false);


More information about the Libreoffice-commits mailing list