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

Caolán McNamara caolanm at redhat.com
Thu Oct 19 22:40:02 UTC 2017


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

New commits:
commit 312a8a32a579160fd1665ab10dc37bd73c89961a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 19 17:11:37 2017 +0100

    ofz+ubsan: runtime error: left shift cannot be represented in type
    
    Change-Id: Ic153b39475abbd562e4c81b47089ca8280080cff
    Reviewed-on: https://gerrit.libreoffice.org/43569
    Tested-by: Jenkins <ci at libreoffice.org>
    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 1f7f0769f0ce..0933ba7d265e 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -71,10 +71,12 @@ rtl::Reference< StgPage > StgFAT::GetPhysPage( sal_Int32 nByteOff )
 
 sal_Int32 StgFAT::GetNextPage( sal_Int32 nPg )
 {
-    if( nPg >= 0 )
+    if (nPg >= 0)
     {
-      rtl::Reference< StgPage > pPg = GetPhysPage( nPg << 2 );
-      nPg = pPg.is() ? StgCache::GetFromPage( pPg, m_nOffset >> 2 ) : STG_EOF;
+        if (nPg > (SAL_MAX_INT32 >> 2))
+            return STG_EOF;
+        rtl::Reference< StgPage > pPg = GetPhysPage( nPg << 2 );
+        nPg = pPg.is() ? StgCache::GetFromPage( pPg, m_nOffset >> 2 ) : STG_EOF;
     }
     return nPg;
 }


More information about the Libreoffice-commits mailing list