radv: fix copying mutable descriptors to sampler descriptors

This fixes a heap-buffer-overflow detected by ASAN.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14330>
This commit is contained in:
Samuel Pitoiset 2021-12-28 11:01:38 +01:00 committed by Marge Bot
parent 6fee84bc2e
commit ce5d7bf508

View file

@ -1283,8 +1283,10 @@ radv_update_descriptor_sets_impl(struct radv_device *device, struct radv_cmd_buf
dst_ptr += dst_binding_layout->size / 4;
if (src_binding_layout->type != VK_DESCRIPTOR_TYPE_SAMPLER &&
src_binding_layout->type != VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR) {
/* Sampler descriptors don't have a buffer list. */
dst_binding_layout->type != VK_DESCRIPTOR_TYPE_SAMPLER &&
src_binding_layout->type != VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR &&
dst_binding_layout->type != VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR) {
/* Sampler/acceleration structure descriptors don't have a buffer list. */
dst_buffer_list[j] = src_buffer_list[j];
}
}