Fix stack overflow on vkGetPhysicalDeviceSparseImageFormatProperties
authorSlawomir Cygan <slawomir.cygan@intel.com>
Tue, 27 Mar 2018 14:41:33 +0000 (16:41 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 6 Apr 2018 10:48:33 +0000 (06:48 -0400)
Function may return random number of structs overwriting
the sparseImageFormatProperties variable.

Components: Vulkan

VK-GL-CTS Issue: 1103

Affects: dEQP-VK.texture.*.sparse_*

Change-Id: I101b72360145c23cef14cfeb50c7f9cd02e62e2f

external/vulkancts/modules/vulkan/texture/vktTextureTestUtil.cpp

index e6a61947ea2bc5008a2951c9b33a235038d4388f..a1badbda7ebc272c6f93c6d4dd59eaee3138251d 100644 (file)
@@ -345,9 +345,8 @@ void TextureBinding::updateTextureData (const TestTextureSp& textureData, const
 
        if (sparse)
        {
-               deUint32 numSparseImageProperties;
-               vk::VkSparseImageFormatProperties                                       sparseImageFormatProperties;
-               m_context.getInstanceInterface().getPhysicalDeviceSparseImageFormatProperties(m_context.getPhysicalDevice(), format, imageType, VK_SAMPLE_COUNT_1_BIT, imageUsageFlags, imageTiling, &numSparseImageProperties, &sparseImageFormatProperties);
+               deUint32 numSparseImageProperties = 0;
+               m_context.getInstanceInterface().getPhysicalDeviceSparseImageFormatProperties(m_context.getPhysicalDevice(), format, imageType, VK_SAMPLE_COUNT_1_BIT, imageUsageFlags, imageTiling, &numSparseImageProperties, DE_NULL);
                if (numSparseImageProperties == 0)
                        TCU_THROW(NotSupportedError, (std::string("Sparse format not supported: ") + vk::getFormatName(format)).c_str());
        }