summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/venus/vkr_device_memory.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/venus/vkr_device_memory.c b/src/venus/vkr_device_memory.c
index 80e896a..c2a3a23 100644
--- a/src/venus/vkr_device_memory.c
+++ b/src/venus/vkr_device_memory.c
@@ -115,6 +115,11 @@ vkr_dispatch_vkAllocateMemory(struct vn_dispatch_context *dispatch,
!(export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
struct vkr_device_memory *mem = NULL;
const uint32_t mem_type_index = args->pAllocateInfo->memoryTypeIndex;
+ if (mem_type_index >= physical_dev->memory_properties.memoryTypeCount) {
+ args->ret = VK_ERROR_UNKNOWN;
+ return;
+ }
+
const uint32_t property_flags =
physical_dev->memory_properties.memoryTypes[mem_type_index].propertyFlags;
uint32_t valid_fd_types = 0;