mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-31 11:51:04 +00:00
Protect against captures that try to allocate memory from invalid types
This commit is contained in:
@@ -289,6 +289,16 @@ bool WrappedVulkan::Serialise_vkAllocateMemory(SerialiserType &ser, VkDevice dev
|
||||
|
||||
UnwrapNextChain(m_State, "VkMemoryAllocateInfo", tempMem, (VkBaseInStructure *)&patched);
|
||||
|
||||
if(patched.memoryTypeIndex >= m_PhysicalDeviceData.memProps.memoryTypeCount)
|
||||
{
|
||||
RDCERR(
|
||||
"Tried to allocate memory from index %u, but on replay we only have %u memory types.\n"
|
||||
"This is most likely caused by incompatible hardware or drivers between capture and "
|
||||
"replay, causing a change in memory requirements.",
|
||||
patched.memoryTypeIndex, m_PhysicalDeviceData.memProps.memoryTypeCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
VkResult ret = ObjDisp(device)->AllocateMemory(Unwrap(device), &patched, NULL, &mem);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
|
||||
Reference in New Issue
Block a user