Memory overlap fix proposal.

This commit is contained in:
David Carlier 2020-03-01 11:15:37 +00:00
parent b36efa4ef4
commit 8f0ac7ceee

View File

@ -664,7 +664,7 @@ void CScriptArray::RemoveRange(asUINT start, asUINT count)
// Compact the elements
// As objects in arrays of objects are not stored inline, it is safe to use memmove here
// since we're just copying the pointers to objects and not the actual objects.
memcpy(buffer->data + start*elementSize, buffer->data + (start + count)*elementSize, (buffer->numElements - count)*elementSize);
memmove(buffer->data + start*elementSize, buffer->data + (start + count)*elementSize, (buffer->numElements - count)*elementSize);
buffer->numElements -= count;
}