summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2008-11-19 13:34:57 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2008-11-19 13:34:57 +0000
commit5202aa22b98b063f3e969d6de29a0c3578f00dac (patch)
treec24eae2ccb8d8db9c320c7619523af8eee74a11d /sot
parent7f5f6b548d071d412efb78e9fee21d68ad6700bc (diff)
CWS-TOOLING: integrate CWS fwk94_DEV300
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgelem.cxx12
-rw-r--r--sot/source/sdstor/stgstrms.cxx5
2 files changed, 13 insertions, 4 deletions
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 5c0a7a009e94..d6fc8ce8f241 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: stgelem.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.6.1 $
*
* This file is part of OpenOffice.org.
*
@@ -158,12 +158,18 @@ BOOL StgHeader::Store( StgIo& rIo )
return BOOL( !bDirty );
}
-// Perform thorough checks also on unknown variables
+static bool lcl_wontoverflow(short shift)
+{
+ return shift >= 0 && shift < (short)sizeof(short) * 8 - 1;
+}
+// Perform thorough checks also on unknown variables
BOOL StgHeader::Check()
{
return BOOL( memcmp( cSignature, cStgSignature, 8 ) == 0
- && (short) ( nVersion >> 16 ) == 3 );
+ && (short) ( nVersion >> 16 ) == 3 )
+ && lcl_wontoverflow(nPageSize)
+ && lcl_wontoverflow(nDataPageSize);
}
INT32 StgHeader::GetFATPage( short n ) const
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index e3aa0ca7122d..46ae3529439c 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: stgstrms.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.11.8.1 $
*
* This file is part of OpenOffice.org.
*
@@ -823,6 +823,9 @@ void* StgDataStrm::GetPtr( INT32 Pos, BOOL bForce, BOOL bDirty )
INT32 StgDataStrm::Read( void* pBuf, INT32 n )
{
+ if ( n < 0 )
+ return 0;
+
if( ( nPos + n ) > nSize )
n = nSize - nPos;
INT32 nDone = 0;