From 8636f11d7336a58c0fd30fb32efd1c170cb3d5bb Mon Sep 17 00:00:00 2001 From: Sungun Park Date: Fri, 18 Jul 2025 18:07:05 +0000 Subject: [PATCH] Fix handle allocator (#8970) Use the right type for the index to prevent the value from being truncated. --- filament/backend/include/private/backend/HandleAllocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filament/backend/include/private/backend/HandleAllocator.h b/filament/backend/include/private/backend/HandleAllocator.h index 0f02184234..5ddb1ab670 100644 --- a/filament/backend/include/private/backend/HandleAllocator.h +++ b/filament/backend/include/private/backend/HandleAllocator.h @@ -204,7 +204,7 @@ public: } else { // check for heap handle use-after-free if (UTILS_UNLIKELY(!mUseAfterFreeCheckDisabled)) { - uint8_t const index = (handle.getId() & HANDLE_INDEX_MASK); + HandleBase::HandleId const index = (handle.getId() & HANDLE_INDEX_MASK); // if we've already handed out this handle index before, it's definitely a // use-after-free, otherwise it's probably just a corrupted handle if (index < mId) {