diff options
Diffstat (limited to 'sot/source/sdstor/stgcache.hxx')
-rw-r--r-- | sot/source/sdstor/stgcache.hxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sot/source/sdstor/stgcache.hxx b/sot/source/sdstor/stgcache.hxx index c9b123c17f9d..7efbffae5b4f 100644 --- a/sot/source/sdstor/stgcache.hxx +++ b/sot/source/sdstor/stgcache.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SOT_SOURCE_SDSTOR_STGCACHE_HXX #define INCLUDED_SOT_SOURCE_SDSTOR_STGCACHE_HXX +#include <o3tl/safeint.hxx> #include <osl/endian.h> #include <rtl/ref.hxx> #include <tools/stream.hxx> @@ -115,7 +116,7 @@ public: inline sal_Int32 StgCache::GetFromPage ( const rtl::Reference< StgPage >& rPage, short nOff ) { - if( ( nOff >= static_cast<short>( rPage->GetSize() / sizeof( sal_Int32 ) ) ) || nOff < 0 ) + if( nOff < 0 || ( o3tl::make_unsigned(nOff) >= rPage->GetSize() / sizeof( sal_Int32 ) ) ) return -1; sal_Int32 n = static_cast<sal_Int32*>(rPage->GetData())[ nOff ]; #ifdef OSL_BIGENDIAN |