Index: source/sdstor/stgdir.cxx =================================================================== RCS file: /cvs/util/sot/source/sdstor/stgdir.cxx,v retrieving revision 1.10 diff -u -r1.10 stgdir.cxx --- source/sdstor/stgdir.cxx 19 Apr 2007 09:24:37 -0000 1.10 +++ source/sdstor/stgdir.cxx 22 Oct 2007 15:05:16 -0000 @@ -45,6 +45,8 @@ #include "stgdir.hxx" #include "stgio.hxx" +#include + //////////////////////////// class StgDirEntry ///////////////////////////// // This class holds the dir entry data and maintains dirty flags for both @@ -817,6 +819,7 @@ { BOOL bOk(FALSE); StgDirEntry* pCur = new StgDirEntry( p, &bOk ); + if( !bOk ) { delete pCur; @@ -833,9 +836,18 @@ INT32 nRight = pCur->aEntry.GetLeaf( STG_RIGHT ); // substorage? INT32 nLeaf = STG_FREE; - if( pCur->aEntry.GetType() == STG_STORAGE - || pCur->aEntry.GetType() == STG_ROOT ) + if( pCur->aEntry.GetType() == STG_STORAGE || pCur->aEntry.GetType() == STG_ROOT ) + { nLeaf = pCur->aEntry.GetLeaf( STG_CHILD ); + if (nLeaf != STG_FREE && nLeaf == n) + { + fprintf(stderr, "Child of ole2 storage node is itself! %d\n", nLeaf); + delete pCur; + rIo.SetError( SVSTREAM_GENERALERROR ); + return; + } + } + if( nLeaf != 0 && nLeft != 0 && nRight != 0 ) { if( StgAvlNode::Insert