diff options
author | Philipp Zabel <[email protected]> | 2016-02-16 22:55:33 +0100 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-16 14:42:26 -0800 |
commit | ecd1d94d1c74be6481ebc6adde01fe73c7d41331 (patch) | |
tree | ca69874dded4013b492de298a42c0b657990f374 | |
parent | 48087cfc4e90f39547cb2ebc06e044f56ccb2983 (diff) |
anv: pCreateInfo->pApplicationInfo parameter to vkCreateInstance may be NULL
Fix a NULL pointer dereference in anv_CreateInstance in case
the pApplicationInfo field of the supplied VkInstanceCreateInfo
structure is NULL [1].
[1] https://www.khronos.org/registry/vulkan/specs/1.0/apispec.html#VkInstanceCreateInfo
Signed-off-by: Philipp Zabel <[email protected]>
-rw-r--r-- | src/vulkan/anv_device.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index a6ce1764f6b..68639068324 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -214,7 +214,9 @@ VkResult anv_CreateInstance( assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO); - uint32_t client_version = pCreateInfo->pApplicationInfo->apiVersion; + uint32_t client_version = pCreateInfo->pApplicationInfo ? + pCreateInfo->pApplicationInfo->apiVersion : + VK_MAKE_VERSION(1, 0, 0); if (VK_MAKE_VERSION(1, 0, 0) > client_version || client_version > VK_MAKE_VERSION(1, 0, 3)) { return vk_errorf(VK_ERROR_INCOMPATIBLE_DRIVER, @@ -249,7 +251,7 @@ VkResult anv_CreateInstance( else instance->alloc = default_alloc; - instance->apiVersion = pCreateInfo->pApplicationInfo->apiVersion; + instance->apiVersion = client_version; instance->physicalDeviceCount = -1; _mesa_locale_init(); |