Mesa (master): anv: off-by-one in GetDescriptorSetLayoutSupport

Scott D Phillips scott-ph at kemper.freedesktop.org
Tue Mar 20 14:58:37 UTC 2018


Module: Mesa
Branch: master
Commit: d849d36c6cc99cb7a7ad4b285e3e896d593da07b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d849d36c6cc99cb7a7ad4b285e3e896d593da07b

Author: Scott D Phillips <scott.d.phillips at intel.com>
Date:   Mon Mar 19 15:39:25 2018 -0700

anv: off-by-one in GetDescriptorSetLayoutSupport

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 at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

---

 src/intel/vulkan/anv_descriptor_set.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
index 2a3c496a9f..67511e4b28 100644
--- a/src/intel/vulkan/anv_descriptor_set.c
+++ b/src/intel/vulkan/anv_descriptor_set.c
@@ -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) {




More information about the mesa-commit mailing list