mirror of https://github.com/stella-emu/stella.git
Fixed some potential out-of-bounds accesses detected by _GLIBCXX_DEBUG.
This commit is contained in:
parent
ba44910f1e
commit
6815513d47
|
@ -82,7 +82,10 @@ class LinkedObjectPool
|
|||
iter it = myCurrent;
|
||||
uInt32 idx = 1;
|
||||
|
||||
while(it-- != myList.begin()) ++idx;
|
||||
while(it != myList.begin()) {
|
||||
++idx;
|
||||
--it;
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
@ -227,7 +230,8 @@ class LinkedObjectPool
|
|||
active list.
|
||||
*/
|
||||
void removeToLast() {
|
||||
myPool.splice(myPool.end(), myList, std::next(myCurrent, 1), myList.end());
|
||||
if(currentIsValid())
|
||||
myPool.splice(myPool.end(), myList, std::next(myCurrent, 1), myList.end());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue