Protect against overflow in MemRefs

Change-Id: I70d4143bd5bcdefe4f5f0a610aec6ff0321112f5
This commit is contained in:
Benson Joeris
2019-12-13 22:52:58 +00:00
committed by Baldur Karlsson
parent 4ea32eac43
commit b5f40e68e8
+2
View File
@@ -1329,6 +1329,7 @@ struct MemRefs
inline MemRefs(VkDeviceSize offset, VkDeviceSize size, FrameRefType refType)
: initializedLiveRes(NULL)
{
size = RDCMIN(size, UINT64_MAX - offset);
rangeRefs.update(offset, offset + size, refType, ComposeFrameRefs);
}
template <typename Compose>
@@ -1346,6 +1347,7 @@ template <typename Compose>
FrameRefType MemRefs::Update(VkDeviceSize offset, VkDeviceSize size, FrameRefType refType,
Compose comp)
{
size = RDCMIN(size, UINT64_MAX - offset);
FrameRefType maxRefType = eFrameRef_None;
rangeRefs.update(offset, offset + size, refType,
[&maxRefType, comp](FrameRefType oldRef, FrameRefType newRef) -> FrameRefType {