From cc678c9ce934c1c83f6ed26696f896ca96ddefc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Wed, 8 Apr 2020 10:55:37 +0200 Subject: [PATCH] radv: check buffer size in vkCreateBuffer() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: dEQP-VK.api.buffer.basic.size_max_uint64 Signed-off-by: Samuel Iglesias Gonsálvez Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 00e3a7ca947..fb81d782a14 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -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, -- 2.30.2