radv: avoid oob read during clear

when clearing a depth/stencil image the passed colorvalue pointer is
smaller than the VkClearValue struct size

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8288>
This commit is contained in:
Mike Blumenkrantz 2020-12-31 15:44:32 -05:00 committed by Marge Bot
parent 33fd9e5d8a
commit 1a7b7b17ad
1 changed files with 6 additions and 1 deletions

View File

@ -2204,7 +2204,12 @@ radv_cmd_clear_image(struct radv_cmd_buffer *cmd_buffer,
bool cs)
{
VkFormat format = image->vk_format;
VkClearValue internal_clear_value = *clear_value;
VkClearValue internal_clear_value;
if (image->aspects & VK_IMAGE_ASPECT_COLOR_BIT)
internal_clear_value.color = clear_value->color;
else
internal_clear_value.depthStencil = clear_value->depthStencil;
if (format == VK_FORMAT_E5B9G9R9_UFLOAT_PACK32) {
uint32_t value;