Skip to content
Snippets Groups Projects
Commit 576e9ff9 authored by Lionel Landwerlin's avatar Lionel Landwerlin Committed by Eric Engestrom
Browse files

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: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 3b361b23 ("vulkan: Implement VK_EXT_debug_utils")
Reviewed-by: default avatarFaith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <mesa/mesa!30516>
(cherry picked from commit ae9a249d)
parent 9a1327f2
No related branches found
No related tags found
No related merge requests found
......@@ -4054,7 +4054,7 @@
"description": "vulkan/runtime: allow null/empty debug names",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "3b361b234ac49f41a94a9bcf94fb68d5407b4b83",
"notes": null
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment