diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/rc/resmgr.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index 8d83533a8fbf..8af6da3bd16b 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -1012,18 +1012,29 @@ void ResMgr::TestStack( const Resource* pResObj ) { osl::Guard<osl::Mutex> aGuard( getResMgrMutex() ); + int upperLimit = nCurStack; + + if ( upperLimit < 0 ) + { + OSL_FAIL( "resource stack underrun!" ); + upperLimit = aStack.size() - 1; + } + else if ( upperLimit >= static_cast<int>(aStack.size()) ) + { + OSL_FAIL( "stack occupation index > allocated stack size" ); + upperLimit = aStack.size() - 1; + } + if ( DbgIsResource() ) { - for( int i = 1; i <= nCurStack; ++i ) + for( int i = 1; i <= upperLimit; ++i ) { if ( aStack[i].pResObj == pResObj ) { -#ifdef DBG_UTIL RscError_Impl( "Resource not freed! ", this, aStack[i].pResource->GetRT(), aStack[i].pResource->GetId(), aStack, i-1 ); -#endif } } } |