From a162a2194744ed9d9c095f0160e463a7a1b4e36c Mon Sep 17 00:00:00 2001 From: Zander Khan Date: Sat, 16 Jan 2021 17:52:14 +0000 Subject: [PATCH] Ensure we cannot remove an item outside the current length of the queue --- lib/std/priority_dequeue.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/priority_dequeue.zig b/lib/std/priority_dequeue.zig index 5dd861bcbd..540f37960a 100644 --- a/lib/std/priority_dequeue.zig +++ b/lib/std/priority_dequeue.zig @@ -191,6 +191,7 @@ pub fn PriorityDequeue(comptime T: type) type { /// same order as iterator, which is not necessarily priority /// order. pub fn removeIndex(self: *Self, index: usize) T { + assert(self.len > index); const item = self.items[index]; const last = self.items[self.len - 1];