Avoid undefined signed integer overflow

Change-Id: Idbb8109c36dfe1c8ed4acb8dff1a1538e386abd8
This commit is contained in:
Stephan Bergmann 2014-05-28 08:53:46 +02:00
parent 7bc0082106
commit 1d203f2d3f

View file

@ -967,13 +967,8 @@ bool StgDirStrm::Store()
void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty )
{
if( n < 0 )
return NULL;
n *= STGENTRY_SIZE;
if( n >= nSize )
return NULL;
return GetPtr( n, true, bDirty );
return n < 0 || n >= nSize / STGENTRY_SIZE
? NULL : GetPtr( n * STGENTRY_SIZE, true, bDirty );
}
// Find a dir entry.