Fix a bounds check in remove_abandoned (#5024)

This commit is contained in:
Nicolas Silva 2024-01-09 17:24:18 +01:00 committed by GitHub
parent 37755b6985
commit 4400a58470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ impl<A: HalApi, Id: TypedId, T: Resource<Id>> ResourceTracker<Id, T>
fn remove_abandoned(&mut self, id: Id) -> bool {
let index = id.unzip().0 as usize;
if index > self.metadata.size() {
if index >= self.metadata.size() {
return false;
}