VOYEUR: Add a check to avoid potential use of negative value as an array index

This commit is contained in:
Strangerke 2014-03-15 10:21:40 +01:00
parent 2e440e54e4
commit f73901ca9a

View File

@ -86,6 +86,9 @@ bool ThreadResource::loadAStack(int stackId) {
} }
void ThreadResource::unloadAStack(int stackId) { void ThreadResource::unloadAStack(int stackId) {
if (stackId < 0)
return;
if ((_vm->_stampFlags & 1) && _useCount[stackId]) { if ((_vm->_stampFlags & 1) && _useCount[stackId]) {
if (--_useCount[stackId] == 0) { if (--_useCount[stackId] == 0) {
_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[stackId]); _vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[stackId]);