From 68b7b4fb38e0bbdb5f84443a6a071ecd0fed7bd2 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sat, 13 Nov 2021 22:43:37 +0100 Subject: [PATCH] radv: Don't crash if VkExternalImageFormatProperties isn't provided. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5623 Stable: 21.2 21.3 Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_formats.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index 3727376eb53..7a3508fc4c0 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -1796,6 +1796,13 @@ radv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, * present and VkExternalImageFormatProperties will be ignored. */ if (external_info && external_info->handleType != 0) { + VkExternalImageFormatProperties fallback_external_props; + + if (!external_props) { + memset(&fallback_external_props, 0, sizeof(fallback_external_props)); + external_props = &fallback_external_props; + } + get_external_image_format_properties(physical_device, base_info, external_info->handleType, &external_props->externalMemoryProperties, &base_props->imageFormatProperties);