summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
Diffstat (limited to 'sot')
-rw-r--r--sot/qa/complex/olesimplestorage/Test01.java2
-rw-r--r--sot/source/sdstor/stg.cxx2
-rw-r--r--sot/source/sdstor/stgdir.cxx30
-rw-r--r--sot/source/sdstor/stgdir.hxx6
-rw-r--r--sot/source/sdstor/stgelem.cxx2
-rw-r--r--sot/source/sdstor/ucbstorage.cxx14
6 files changed, 39 insertions, 17 deletions
diff --git a/sot/qa/complex/olesimplestorage/Test01.java b/sot/qa/complex/olesimplestorage/Test01.java
index 687027c8ab81..1c50d6c76784 100644
--- a/sot/qa/complex/olesimplestorage/Test01.java
+++ b/sot/qa/complex/olesimplestorage/Test01.java
@@ -91,7 +91,7 @@ public class Test01 implements OLESimpleStorageTest
//commit the storage and close it
xOLESimpleStorage.commit ();
- m_aTestHelper.Message ( "Storage commited." );
+ m_aTestHelper.Message ( "Storage committed." );
xOLESimpleStorage.dispose ();
for ( int i = 0; i < pStreamCnt; ++i )
{
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index d17de661910d..8e5118091fd7 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -741,7 +741,7 @@ sal_Bool Storage::CopyTo( const String& rElem, BaseStorage* pDest, const String&
if( pElem )
{
/*
- this lines are misterious !!! MM
+ this lines are mysterious !!! MM
if( !pElem->IsContained( pDest->pEntry ) )
{
SetError( SVSTREAM_ACCESS_DENIED );
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index d0cf28e5bb8a..f4269955f70f 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -827,7 +827,7 @@ StgDirStrm::StgDirStrm( StgIo& r )
// temporarily use this instance as owner, so
// the TOC pages can be removed.
pEntry = (StgDirEntry*) this; // just for a bit pattern
- SetupEntry( 0, pRoot );
+ SetupEntry(0, pRoot, nSize/STGENTRY_SIZE, 0);
rIo.Revert( pEntry );
pEntry = NULL;
}
@@ -840,8 +840,26 @@ StgDirStrm::~StgDirStrm()
// Recursively parse the directory tree during reading the TOC stream
-void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
+void StgDirStrm::SetupEntry (
+ const sal_Int32 n,
+ StgDirEntry* pUpper,
+ const sal_Int32 nEntryCount,
+ const sal_Int32 nDepth)
{
+ if (nDepth > nEntryCount)
+ {
+ // Tree grew higher than there are different nodes. Looks like
+ // something is wrong with the file. Return now to avoid
+ // infinite recursion.
+ return;
+ }
+ else if (n>=nEntryCount || (n<0 && n!=STG_FREE))
+ {
+ // n has an invalid value. Don't access the corresponding
+ // stream content.
+ return;
+ }
+
void* p = ( n == STG_FREE ) ? NULL : GetEntry( n );
if( p )
{
@@ -852,7 +870,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
{
delete pCur;
rIo.SetError( SVSTREAM_GENERALERROR );
- // an error occured
+ // an error occurred
return;
}
@@ -889,9 +907,9 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
delete pCur; pCur = NULL;
return;
}
- SetupEntry( nLeft, pUpper );
- SetupEntry( nRight, pUpper );
- SetupEntry( nLeaf, pCur );
+ SetupEntry( nLeft, pUpper, nEntryCount, nDepth+1);
+ SetupEntry( nRight, pUpper, nEntryCount, nDepth+1);
+ SetupEntry( nLeaf, pCur, nEntryCount, nDepth+1);
}
}
}
diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
index daf2f4b3d99a..11f03107f2e1 100644
--- a/sot/source/sdstor/stgdir.hxx
+++ b/sot/source/sdstor/stgdir.hxx
@@ -100,7 +100,11 @@ class StgDirStrm : public StgDataStrm
friend class StgIterator;
StgDirEntry* pRoot; // root of dir tree
short nEntries; // entries per page
- void SetupEntry( sal_Int32, StgDirEntry* );
+ void SetupEntry(
+ const sal_Int32 n,
+ StgDirEntry* pUpper,
+ const sal_Int32 nEntryCount,
+ const sal_Int32 nDepth);
public:
StgDirStrm( StgIo& );
~StgDirStrm();
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 2e4bf396d4d9..0327f3e1aa6c 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -258,7 +258,7 @@ void StgHeader::SetMasters( sal_Int32 n )
///////////////////////////// class StgEntry /////////////////////////////
-// This class is only a wrapper around teh dir entry structure
+// This class is only a wrapper around the dir entry structure
// which retrieves and sets data.
// The name must be smaller than 32 chars. Conversion into Unicode
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 6130b4cfbd1c..356b3fe929cf 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -578,7 +578,7 @@ public:
SV_DECL_IMPL_REF( UCBStorage_Impl );
-// this struct contains all neccessary information on an element inside a UCBStorage
+// this struct contains all necessary information on an element inside a UCBStorage
struct UCBStorageElement_Impl
{
String m_aName; // the actual URL relative to the root "folder"
@@ -775,7 +775,7 @@ Reference<XInputStream> UCBStorageStream_Impl::GetXInputStream()
if( aResult.is() )
{
// temporary stream can not be used here any more
- // and can not be opened untill wrapper is closed
+ // and can not be opened until wrapper is closed
// stream is deleted by wrapper after use
m_pStream = NULL;
m_nRepresentMode = xinputstream;
@@ -842,7 +842,7 @@ sal_Bool UCBStorageStream_Impl::Init()
if( m_bSourceRead && !m_rSource.is() )
{
- // source file contain usefull information and is not opened
+ // source file contain useful information and is not opened
// open it from the point of noncopied data
try
@@ -1278,7 +1278,7 @@ sal_Int16 UCBStorageStream_Impl::Commit()
sal_Bool UCBStorageStream_Impl::Revert()
{
- // if an OLEStorage is created on this stream, no "revert" is neccessary because OLEStorages do nothing on "Revert" !
+ // if an OLEStorage is created on this stream, no "revert" is necessary because OLEStorages do nothing on "Revert" !
if ( m_bCommited )
{
DBG_ERROR("Revert while commit is in progress!" );
@@ -2575,7 +2575,7 @@ sal_Int16 UCBStorage_Impl::Commit()
return nRet;
}
- // after successfull root commit all elements names and types are adjusted and all removed elements
+ // after successful root commit all elements names and types are adjusted and all removed elements
// are also removed from the lists
UCBStorageElement_Impl* pInnerElement = m_aChildrenList.First();
sal_Bool bRet = sal_True;
@@ -2876,7 +2876,7 @@ sal_Bool UCBStorage::CopyTo( const String& rElemName, BaseStorage* pDest, const
}
else
{
- // for copying no optimization is usefull, because in every case the stream data must be copied
+ // for copying no optimization is useful, because in every case the stream data must be copied
UCBStorageElement_Impl* pElement = FindElement_Impl( rElemName );
if ( pElement )
return CopyStorageElement_Impl( *pElement, pDest, rNew );
@@ -2893,7 +2893,7 @@ sal_Bool UCBStorage::Commit()
// mark this storage for sending it on root commit
pImp->m_bCommited = sal_True;
if ( pImp->m_bIsRoot )
- // the root storage coordinates commiting by sending a Commit command to its content
+ // the root storage coordinates committing by sending a Commit command to its content
return ( pImp->Commit() != COMMIT_RESULT_FAILURE );
else
return sal_True;