Mesa (main): radv: Don't crash if VkExternalImageFormatProperties isn't provided.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 10:52:21 UTC 2021


Module: Mesa
Branch: main
Commit: 68b7b4fb38e0bbdb5f84443a6a071ecd0fed7bd2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=68b7b4fb38e0bbdb5f84443a6a071ecd0fed7bd2

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Sat Nov 13 22:43:37 2021 +0100

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 <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13786>

---

 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);



More information about the mesa-commit mailing list