queue/Queue: allocate MoveRange() buffer on the heap

No variable-length arrays on the stack.
This commit is contained in:
Max Kellermann 2019-06-06 12:38:42 +02:00
parent 3c1f7c77f0
commit 3eae3a2826

View File

@ -150,7 +150,8 @@ Queue::MovePostion(unsigned from, unsigned to) noexcept
void
Queue::MoveRange(unsigned start, unsigned end, unsigned to) noexcept
{
Item tmp[end - start];
const auto tmp = std::make_unique<Item[]>(end - start);
// Copy the original block [start,end-1]
for (unsigned i = start; i < end; i++)
tmp[i - start] = items[i];