summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-05-28 08:53:46 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-28 08:55:11 +0200
commit1d203f2d3f45e3323530826eb5642eb52d1c1909 (patch)
tree0605f60734cec066d0d62e475877775c93dcb541 /sot
parent7bc008210621429835ddb75359f2268b5f66ea8f (diff)
Avoid undefined signed integer overflow
Change-Id: Idbb8109c36dfe1c8ed4acb8dff1a1538e386abd8
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgdir.cxx9
1 files changed, 2 insertions, 7 deletions
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 6aed09b970ea..f4903a57f1db 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -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.