From 94e58d4e24e40065acb34bf815707e32acaadefb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Four=C3=A9?= Date: Tue, 25 Aug 2026 14:04:27 +0200 Subject: [PATCH] Fixed buffer overflow after using VkCtx cmdbuf ctor. --- public/tracy/TracyVulkan.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/tracy/TracyVulkan.hpp b/public/tracy/TracyVulkan.hpp index f137d8bf..9a3ac47c 100644 --- a/public/tracy/TracyVulkan.hpp +++ b/public/tracy/TracyVulkan.hpp @@ -174,7 +174,7 @@ public: WriteInitialItem( physdev, tcpu, tgpu ); - m_res = (int64_t*)tracy_malloc( sizeof( int64_t ) * m_queryCount ); + AllocateQueryResultBuffer(); } #if defined VK_EXT_host_query_reset @@ -223,9 +223,7 @@ public: WriteInitialItem( physdev, tcpu, tgpu ); - // We need the buffer to be twice as large for availability values - size_t resSize = sizeof( int64_t ) * m_queryCount * 2; - m_res = (int64_t*)tracy_malloc( resSize ); + AllocateQueryResultBuffer(); } #endif @@ -414,6 +412,12 @@ private: } } + tracy_force_inline void AllocateQueryResultBuffer() + { + // We need the buffer to be twice as large for availability values + m_res = (int64_t*)tracy_malloc( sizeof( int64_t ) * m_queryCount * 2 ); + } + tracy_force_inline void FindAvailableTimeDomains( VkPhysicalDevice physicalDevice, PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT _vkGetPhysicalDeviceCalibrateableTimeDomainsEXT ) { uint32_t num;