mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 04:40:11 +01:00
pvr: Fix possible allocation of 0 size
Some tests had `input_count == 0` so the driver would attempt to `vk_alloc()` a size of zero and error out. Add some checks to prevent that. Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23070>
This commit is contained in:
parent
5f60444b13
commit
792cf1caff
1 changed files with 6 additions and 0 deletions
|
|
@ -821,6 +821,9 @@ pvr_copy_storage_details(struct pvr_renderpass_context *ctx,
|
|||
input_subpass->color_count + input_subpass->input_count;
|
||||
VkResult result;
|
||||
|
||||
if (max_rts == 0)
|
||||
return VK_SUCCESS;
|
||||
|
||||
hw_subpass->setup.mrt_resources =
|
||||
vk_zalloc(ctx->allocator,
|
||||
sizeof(hw_subpass->setup.mrt_resources[0U]) * max_rts,
|
||||
|
|
@ -847,6 +850,9 @@ pvr_copy_storage_details(struct pvr_renderpass_context *ctx,
|
|||
|
||||
hw_subpass->setup.num_render_targets = input_subpass->color_count;
|
||||
|
||||
if (input_subpass->input_count == 0)
|
||||
return VK_SUCCESS;
|
||||
|
||||
/* For this subpass's input attachments. */
|
||||
hw_subpass->input_access = vk_alloc(ctx->allocator,
|
||||
sizeof(hw_subpass->input_access[0U]) *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue