diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2012-02-13 17:53:19 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2012-02-13 17:58:31 +0100 |
commit | bbeb0f7a82945e8d7b98e5d5da9f69dfc5c6fabe (patch) | |
tree | c4468e7a8674f78a00b6ee7df0eee9be6a120d35 /tools | |
parent | 8eb33ee13519bd3059cdb2019ef843fbb9a7fbd7 (diff) |
ResMgr::TestStack more robust
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 } } } |