Fixed some potential out-of-bounds accesses detected by _GLIBCXX_DEBUG.

This commit is contained in:
Stephen Anthony 2022-05-31 16:49:52 -02:30
parent ba44910f1e
commit 6815513d47
1 changed files with 6 additions and 2 deletions

View File

@ -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());
}
/**