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

Arda Coskunses acoskunses at gmail.com
Thu Dec 22 21:44:39 UTC 2016


OK agree, spec is clear on this matter.

On Thu, Dec 22, 2016 at 1:48 PM, Jason Ekstrand <jason at jlekstrand.net>
wrote:

> 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/0fde3c8d/attachment.html>


More information about the mesa-dev mailing list