summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-19 17:11:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-20 00:39:38 +0200
commit312a8a32a579160fd1665ab10dc37bd73c89961a (patch)
treeb301fb56eecd8f76fdc624045b7ad525cbd66862 /sot
parent143c482b3189cb084fbdf5e6f78f15b43f099e24 (diff)
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@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgstrms.cxx8
1 files changed, 5 insertions, 3 deletions
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;
}