mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
vulkan/shader_module: Fix the lifetime of temporary shader modules
The vk_shader_module_handle_from_nir() macro was constructing a
temporary vk_shader_module and passing it through
vk_shader_module_to_handle(). Since this is a function and not a macro,
it means that the lifetime of the temporary vk_shader_module will end
once the to_handle() function is called. Technically, this is a
use-after-free. I really don't know why no one has been bitten by this
yet....
Fixes: a41e98ddca "vk/util: add a util macro for initializing stack..."
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13101>
This commit is contained in:
parent
2b826582d8
commit
24637a6579
1 changed files with 1 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(vk_shader_module, base, VkShaderModule,
|
|||
|
||||
/* this should only be used for stack-allocated, temporary objects */
|
||||
#define vk_shader_module_handle_from_nir(_nir) \
|
||||
vk_shader_module_to_handle(&(struct vk_shader_module) { \
|
||||
((VkShaderModule)(uintptr_t)&(struct vk_shader_module) { \
|
||||
.base.type = VK_OBJECT_TYPE_SHADER_MODULE, \
|
||||
.nir = _nir, \
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue