Commit cbfd3967 by Alexis Hetu Committed by Alexis Hétu

Control Flow Integrity (cfi) fix

The cfi bot is throwing an error because an object is being assigned with memory containing an invalid vtable. This is caused by assigning a chunk of memory to an object before calling placement new using that memory. This cl assigns the pointer after the object has been constructed to avoid triggering this error. Bug: chromium:1116053 Change-Id: I541d7dc0e884aed7470b97d7d1d91a9bb67edb2d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/47788Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6f74415e
......@@ -263,13 +263,13 @@ static void findTraits(const VkMemoryAllocateInfo *pAllocateInfo,
DeviceMemory::DeviceMemory(const VkMemoryAllocateInfo *pAllocateInfo, void *mem)
: size(pAllocateInfo->allocationSize)
, memoryTypeIndex(pAllocateInfo->memoryTypeIndex)
, external(reinterpret_cast<ExternalBase *>(mem))
{
ASSERT(size);
ExternalMemoryTraits traits;
findTraits(pAllocateInfo, &traits);
traits.instanceInit(external, pAllocateInfo);
traits.instanceInit(mem, pAllocateInfo);
external = reinterpret_cast<ExternalBase *>(mem);
}
void DeviceMemory::destroy(const VkAllocationCallbacks *pAllocator)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment