mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 21:08:11 +02:00
tu: Fix potential alloc of 0 size
We can end up calling vk_multialloc_alloc with 0 size when
`attachment_count` is 0 and `clearValueCount` is 0.
Addressed:
```
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x7faf033ee0 in __interceptor_malloc
../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fada5cc10 in vk_default_alloc ../src/vulkan/util/vk_alloc.c:26
#2 0x7fac50b270 in vk_alloc ../src/vulkan/util/vk_alloc.h:48
#3 0x7fac555040 in vk_multialloc_alloc
../src/vulkan/util/vk_alloc.h:234
#4 0x7fac555040 in void
tu_CmdBeginRenderPass2<(chip)7>(VkCommandBuffer_T*,
VkRenderPassBeginInfo const*, VkSubpassBeginInfo const*)
../src/freedreno/vulkan/tu_cmd_buffer.cc:4634
#5 0x7fac900760 in vk_common_CmdBeginRenderPass
../src/vulkan/runtime/vk_render_pass.c:261
```
seen in:
dEQP-VK.robustness.robustness2.bind.notemplate.r32i.dontunroll.nonvolatile.uniform_texel_buffer.no_fmt_qual.len_252.samples_1.1d.frag
Fixes: 4cfd021e3f ("turnip: Save the renderpass's clear values in the cmdbuf state.")
Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
(cherry picked from commit c923eff742)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32119>
This commit is contained in:
parent
27b2c2b869
commit
e3f3e315af
2 changed files with 3 additions and 3 deletions
|
|
@ -74,7 +74,7 @@
|
|||
"description": "tu: Fix potential alloc of 0 size",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "4cfd021e3f74fd75e7998cae5697a1ba598237d6",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -4631,8 +4631,8 @@ tu_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
|||
const struct tu_image_view *, pass->attachment_count);
|
||||
vk_multialloc_add(&ma, &cmd->state.clear_values, VkClearValue,
|
||||
pRenderPassBegin->clearValueCount);
|
||||
if (!vk_multialloc_alloc(&ma, &cmd->vk.pool->alloc,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)) {
|
||||
if (ma.size && !vk_multialloc_alloc(&ma, &cmd->vk.pool->alloc,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)) {
|
||||
vk_command_buffer_set_error(&cmd->vk, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue