anv: off-by-one in GetDescriptorSetLayoutSupport
authorScott D Phillips <scott.d.phillips@intel.com>
Mon, 19 Mar 2018 22:39:25 +0000 (15:39 -0700)
committerScott D Phillips <scott.d.phillips@intel.com>
Tue, 20 Mar 2018 14:58:10 +0000 (07:58 -0700)
Loop was accessing one more than bindingCount elements from
pBindings, accessing uninitialized memory.

Fixes: ddc4069122 ("anv: Implement VK_KHR_maintenance3")
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_descriptor_set.c

index 2a3c496a9f80286e1cb6cc0c45f2ca0ae0f07fb0..67511e4b28609d38ed9bc2d370f726a06a37cae4 100644 (file)
@@ -42,7 +42,7 @@ void anv_GetDescriptorSetLayoutSupport(
 {
    uint32_t surface_count[MESA_SHADER_STAGES] = { 0, };
 
-   for (uint32_t b = 0; b <= pCreateInfo->bindingCount; b++) {
+   for (uint32_t b = 0; b < pCreateInfo->bindingCount; b++) {
       const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[b];
 
       switch (binding->descriptorType) {