radv: check buffer size in vkCreateBuffer()

Fixes:

   dEQP-VK.api.buffer.basic.size_max_uint64

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4487>
This commit is contained in:
Samuel Iglesias Gonsálvez
2020-04-08 10:55:37 +02:00
committed by Marge Bot
parent a3682670c8
commit cc678c9ce9

View File

@@ -6237,6 +6237,9 @@ VkResult radv_CreateBuffer(
RADV_FROM_HANDLE(radv_device, device, _device);
struct radv_buffer *buffer;
if (pCreateInfo->size > RADV_MAX_MEMORY_ALLOCATION_SIZE)
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,