diff options
author | Lionel Landwerlin <[email protected]> | 2017-01-26 11:06:53 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-02-03 11:08:55 +0000 |
commit | 7c663b1d5efe8c8861fb0b137d40e141c2bc3589 (patch) | |
tree | fe6942669ddf89620f8d48ff500b31ea59dbee91 /src/intel | |
parent | 2554c98d70f4a919fbe71c43e6261b799d2cd6ba (diff) |
anv: fix descriptor pool internal size allocation
The size of the pool is slightly smaller than the size of the
structure containing the whole pool. We need to take that into account
on when setting up the internals.
Fixes a crash due to out of bound memory access in:
dEQP-VK.api.descriptor_pool.out_of_pool_memory
v2: Drop debug traces (Lionel)
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Cc: "17.0 13.0" <[email protected]>
(cherry picked from commit c3421106ec332bf3a943ccf9447edf00dc7f3618)
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_descriptor_set.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index 2926e7a2591..5c518d77fdf 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -329,18 +329,18 @@ VkResult anv_CreateDescriptorPool( } } - const size_t size = - sizeof(*pool) + + const size_t pool_size = pCreateInfo->maxSets * sizeof(struct anv_descriptor_set) + descriptor_count * sizeof(struct anv_descriptor) + buffer_count * sizeof(struct anv_buffer_view); + const size_t total_size = sizeof(*pool) + pool_size; - pool = vk_alloc2(&device->alloc, pAllocator, size, 8, + pool = vk_alloc2(&device->alloc, pAllocator, total_size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (!pool) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - pool->size = size; + pool->size = pool_size; pool->next = 0; pool->free_list = EMPTY; |