mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 09:50:08 +01:00
vulkan/runtime: allow null/empty debug names
VkDebugUtilsObjectNameInfoEXT::pObjectName can be NULL [1] :
"Applications may change the name associated with an object simply
by calling vkSetDebugUtilsObjectNameEXT again with a new string. If
pObjectName is either NULL or an empty string, then any previously
set name is removed."
The current code will segfault.
[1] : https://registry.khronos.org/vulkan/specs/1.3-extensions/html/chap50.html#VkDebugUtilsObjectNameInfoEXT
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 3b361b234a ("vulkan: Implement VK_EXT_debug_utils")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30516>
This commit is contained in:
parent
33a336309e
commit
ae9a249dfe
1 changed files with 6 additions and 4 deletions
|
|
@ -302,10 +302,12 @@ vk_common_SetDebugUtilsObjectNameEXT(
|
|||
vk_free(alloc, object->object_name);
|
||||
object->object_name = NULL;
|
||||
}
|
||||
object->object_name = vk_strdup(alloc, pNameInfo->pObjectName,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!object->object_name)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
if (pNameInfo->pObjectName != NULL) {
|
||||
object->object_name = vk_strdup(alloc, pNameInfo->pObjectName,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!object->object_name)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue