From 3eae3a2826000317269bd6c0b8714d559ed72343 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Jun 2019 12:38:42 +0200 Subject: [PATCH] queue/Queue: allocate MoveRange() buffer on the heap No variable-length arrays on the stack. --- src/queue/Queue.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/queue/Queue.cxx b/src/queue/Queue.cxx index c4d0aac2b..463e673e1 100644 --- a/src/queue/Queue.cxx +++ b/src/queue/Queue.cxx @@ -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(end - start); + // Copy the original block [start,end-1] for (unsigned i = start; i < end; i++) tmp[i - start] = items[i];