summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-10-11 23:08:03 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-10-15 12:18:41 +0100
commit751b72050331c6b97c91bb1d4c69e05e3e32d998 (patch)
tree71290d171ff50d71042b03c5959ef4e05961cb07 /sot
parent761b7e39ebbcd8398c2f67fcead5199285b1cbdc (diff)
Resolves: fdo#41642 detect loops in StgDirStrm entry chains
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/stgdir.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index ad1e975faa94..950d130abece 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -820,6 +820,14 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
if( nLeaf != 0 && nLeft != 0 && nRight != 0 )
{
+ //fdo#41642 Do we need to check full chain upwards for loops ?
+ if (pUpper && pUpper->aEntry.GetLeaf(STG_CHILD) == nLeaf)
+ {
+ OSL_FAIL("Leaf node of upper StgDirEntry is same as current StgDirEntry's leaf node. Circular entry chain, discarding link");
+ delete pCur;
+ return;
+ }
+
if( StgAvlNode::Insert
( (StgAvlNode**) ( pUpper ? &pUpper->pDown : &pRoot ), pCur ) )
{
@@ -829,10 +837,10 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
else
{
// bnc#682484: There are some really broken docs out there
- // that contain duplicate entries in 'Directory' section
- // so don't set the error flag here and just skip those
- // (was: rIo.SetError( SVSTREAM_CANNOT_MAKE );)
- delete pCur; pCur = NULL;
+ // that contain duplicate entries in 'Directory' section
+ // so don't set the error flag here and just skip those
+ // (was: rIo.SetError( SVSTREAM_CANNOT_MAKE );)
+ delete pCur;
return;
}
SetupEntry( nLeft, pUpper );