From 1ef3175dc5b74bd7bf864a547f3c9cbc4dba82ed Mon Sep 17 00:00:00 2001 From: Alan Shen Date: Sun, 6 Sep 2026 15:32:50 -0600 Subject: [PATCH] Fix uninitialized x64 handle in CUtlHandleTable::CreateHandle --- src/public/tier1/utlhandletable.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/public/tier1/utlhandletable.h b/src/public/tier1/utlhandletable.h index b44e58f0c7..503f5398e1 100644 --- a/src/public/tier1/utlhandletable.h +++ b/src/public/tier1/utlhandletable.h @@ -290,12 +290,11 @@ UtlHandle_t CUtlHandleTable::CreateHandle( unsigned int nSerial, // but that'd widen the object from 4 bytes of data to 4+4 padding, which would need profiling. static_assert(sizeof(h) == 4); static_assert(sizeof(UtlHandle_t) >= sizeof(h)); - UtlHandle_t ret; + UtlHandle_t ret = 0; memcpy(&ret, &h, sizeof(h)); #if defined(DBGFLAG_ASSERT) && defined(ACTUALLY_COMPILER_MSVC) - UtlHandle_t ref; - ref = *(UtlHandle_t*)&h; - Assert(ret == ref); + Assert(GetListIndex(ret) == nIndex); + Assert(GetSerialNumber(ret) == nSerial); #endif return ret; #else