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

Caolán McNamara caolanm at redhat.com
Wed Nov 29 10:18:09 UTC 2017


 sot/source/sdstor/stgstrms.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit d02e49d9b946277b4797526ed43a96d39757816f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 29 09:02:16 2017 +0000

    ofz#4476 Integer-overflow
    
    Change-Id: I7ee197b396026fb25872f9e79c3be098329a5cee
    Reviewed-on: https://gerrit.libreoffice.org/45467
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 0feebb3107cf..d83ffff27399 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -913,8 +913,9 @@ sal_Int32 StgDataStrm::Read( void* pBuf, sal_Int32 n )
     if ( n < 0 )
         return 0;
 
-    if( ( m_nPos + n ) > m_nSize )
-        n = m_nSize - m_nPos;
+    const auto nAvailable = m_nSize - m_nPos;
+    if (n > nAvailable)
+        n = nAvailable;
     sal_Int32 nDone = 0;
     while( n )
     {


More information about the Libreoffice-commits mailing list