[Mesa-dev] [PATCH 1/2] vulkan/wsi: don't crash on null swapchain

Jason Ekstrand jason at jlekstrand.net
Thu Dec 22 20:48:44 UTC 2016


Nak.

>From the Vulkan spec 1.0.37, valid usage for vkGetSwapchainimagesKHR:

   - *swapchain* must be a valid VkSwapchainKHR handle

We don't silently handle invalid usage.

On Thu, Dec 22, 2016 at 9:30 AM, Arda Coskunses <acoskunses at gmail.com>
wrote:

> When application window closed unexpectedly
> anv_GetSwapchainImagesKHR function getting
> called with invlid parameters which cause a
> crash. Necessary Null check added
> ---
>  src/intel/vulkan/anv_wsi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
> index 669eacc..1e05daf 100644
> --- a/src/intel/vulkan/anv_wsi.c
> +++ b/src/intel/vulkan/anv_wsi.c
> @@ -320,6 +320,9 @@ VkResult anv_GetSwapchainImagesKHR(
>  {
>     ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
>
> +   if(!swapchain)
> +      return VK_INCOMPLETE;
> +
>     return swapchain->get_images(swapchain, pSwapchainImageCount,
>                                  pSwapchainImages);
>  }
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161222/d6ee1e71/attachment.html>


More information about the mesa-dev mailing list