ofz#5747 short->sal_Int32 like in StgDataStrm
authorCaolán McNamara <caolanm@redhat.com>
Sat, 27 Jan 2018 19:38:12 +0000 (19:38 +0000)
committerRene Engelhard <rene@debian.org>
Tue, 6 Aug 2019 18:20:01 +0000 (19:20 +0100)
Change-Id: I254c00b1142d7187beabe5d18532efec036de494
Reviewed-on: https://gerrit.libreoffice.org/48751
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Gbp-Pq: Name CVE-2018-10119.diff

sot/source/sdstor/stgstrms.cxx

index 4f749486c1cc730f880fdb8930bff1b5be7d7bbc..dc07b7647b1d5f911334c5a4ab4dc3a09bc4ca2c 100644 (file)
@@ -1047,7 +1047,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
     // small stream is likely to be < 64 KBytes.
     if( ( m_nPos + n ) > m_nSize )
         n = m_nSize - m_nPos;
-    short nDone = 0;
+    sal_Int32 nDone = 0;
     while( n )
     {
         short nBytes = m_nPageSize - m_nOffset;
@@ -1059,7 +1059,7 @@ sal_Int32 StgSmallStrm::Read( void* pBuf, sal_Int32 n )
                 break;
             // all reading through the stream
             short nRes = (short) m_pData->Read( static_cast<sal_uInt8*>(pBuf) + nDone, nBytes );
-            nDone = nDone + nRes;
+            nDone += nRes;
             m_nPos += nRes;
             n -= nRes;
             m_nOffset = m_nOffset + nRes;
@@ -1078,7 +1078,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
 {
     // you can safely assume that reads are not huge, since the
     // small stream is likely to be < 64 KBytes.
-    short nDone = 0;
+    sal_Int32 nDone = 0;
     if( ( m_nPos + n ) > m_nSize )
     {
         sal_Int32 nOld = m_nPos;
@@ -1102,7 +1102,7 @@ sal_Int32 StgSmallStrm::Write( const void* pBuf, sal_Int32 n )
             if( !m_pData->Pos2Page( nDataPos ) )
                 break;
             short nRes = (short) m_pData->Write( static_cast<sal_uInt8 const *>(pBuf) + nDone, nBytes );
-            nDone = nDone + nRes;
+            nDone += nRes;
             m_nPos += nRes;
             n -= nRes;
             m_nOffset = m_nOffset + nRes;